-
Notifications
You must be signed in to change notification settings - Fork 108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Problems with special Caracters "ä", "ö", "ü" in form fill function #32
Comments
Dear @sgaechter, as I can see from the charset encoding of the page you are referencing
you should probably encode the form field values appropriately like
If you are still running on Python 2, everything should work then. Wenn running on Python 3 already, you will most likely need the small update from #43. With kind regards, |
You dont need to manually encode values any more. mechanize will automatically encode unicode strings in the encoding of the host HTML document when submitting the form. |
Dear @kovidgoyal, thank you so much, this was exactly the functionality I have been looking for but apparently was missing from We have been able to give it a test drive right away (frankheider/ip-navigator-py3.6@ef186481) and would like to confirm that this works like a charm. That was quick, you rock! With kind regards, |
You're welcome, I had somehow missed this bug report, thanks for |
Dear all. |
If I fill a Form with the following Code, special Caracters won't be transferred correctly:
def sendsms():
pr = options[predialstr.get()]
nr = handynumber.get()
txtc = smstext.get("1.0",END)
txt = txtc.strip()
br.set_handle_robots( False )
br.addheaders = [('User-agent', 'Firefox')]
br.open( "http://www.die-startseite.ch/Bern/" )
br.select_form( 'smsBooster' )
br.form[ 'intlPrefix' ] = [str(pr)]
br.form[ 'SMSEingabe' ] = str(nr)
br.form[ 'smsMessage' ] = txt #Error with special swiss Caracters..
br.submit()
resp = br.response()
print(resp)
messagebox.showinfo('Info', 'SMS mit dem Text %s wurde an %s versendet' % (txt, pr + nr))
delFields()
I already attached the Line with utf-8 on my Script:
-- coding: utf-8 --
But somehow it won't pass the Infos corectly to the webform.
Attached the whole Python-Code
free-sms.txt
The text was updated successfully, but these errors were encountered: