browser2: Add an option to convert POST data to the proper encoding
And autodetect it on forms. There is no other way to know what is the expected encoding.
This commit is contained in:
parent
22ce4438e5
commit
14b1b56914
3 changed files with 15 additions and 8 deletions
|
|
@ -63,13 +63,10 @@ class CaptchaPage(HTMLPage):
|
|||
|
||||
|
||||
class PostPage(HTMLPage):
|
||||
# TODO handle encoding in Browser2
|
||||
def post(self, paste, expiration=None):
|
||||
encoding = 'ISO-8859-1'
|
||||
|
||||
form = self.get_form(name='editor')
|
||||
form['code2'] = paste.contents.encode(encoding)
|
||||
form['poster'] = paste.title.encode(encoding)
|
||||
form['code2'] = paste.contents
|
||||
form['poster'] = paste.title
|
||||
if expiration:
|
||||
form['expiry'] = expiration
|
||||
form.submit()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue