Skip to content
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

add support for encoding unicode strings #32

Closed
jdelic opened this issue Apr 14, 2014 · 4 comments
Closed

add support for encoding unicode strings #32

jdelic opened this issue Apr 14, 2014 · 4 comments

Comments

@jdelic
Copy link

jdelic commented Apr 14, 2014

Currently the following "doesn't work":

>>> f = furl('http://example.com')
>>> f.args[u'testö'] = u'testä'
>>> f
<repr(<furl.furl.furl at 0x17438d0>) failed: UnicodeEncodeError: 'ascii' codec can't encode character u'\xf6' in position 4: ordinal not in range(128)>

The documentation explicitly states "Encoding is handled for you" and, of course, means urlencoding, however urllib.urlencode does not automatically handle unicode.

>>> f.args[u'testö'.encode('utf-8')] = u'testä'.encode('utf-8')

"works".

@gruns
Copy link
Owner

gruns commented Apr 14, 2014

Great find.

I'll fix this shortly.

@gruns
Copy link
Owner

gruns commented Apr 16, 2014

furl v0.3.8 supports unicode query keys and values.

>>> f = furl('http://site4dads.ru/')
>>> f.args[u'testö'] = u'testä'
>>> f.url
'http://site4dads.ru/?test%C3%B6=test%C3%A4'

Update to v0.3.8 with

pip install furl --upgrade

Thank you for bringing this issue to my attention @jdelic.

@gruns gruns closed this as completed Apr 16, 2014
@jdelic
Copy link
Author

jdelic commented Apr 22, 2014

thanks for fixing this so fast! :)

doismellburning added a commit to doismellburning/furl that referenced this issue Jan 13, 2015
This implements the test from the comments of
gruns#32 and demonstrates a regression
(bug was reported in 0.3.mumble, fixed in 0.3.8, and is now broken in
0.4.1 and 0.4.2)
@doismellburning
Copy link

#46 shows a regression of this behaviour

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants