Closed BodhiSukha closed 7 years ago
We tested with this address using Python 2.7.10 and it contains none ascii character '¢'. It will work when you encode it to 'utf-8' as below:
'registrationAddress': u'Nidakule Göztepe, Merdivenköy Mah. Bora Sok. ¢ No:1'.encode('utf-8'),
I am closing it. @BodhiSukha please reopen it if you reproduce the problem.
Hi, @sotuzun I am trying to integrate iyzico with opened that runs on python 2.7. I am facing the same error while passing non=ascii chars.
Tired this as well 'registrationAddress': u'Nidakule Göztepe, Merdivenköy Mah. Bora Sok. ¢ No:1'.encode('utf-8'),
@yyenigun's solution is also not working for me
In our tests, API returns encode/decode errors for the
unicode
objects when the object contains non ascii chars like 'ÖöŞşÇçİıĞğÜü', however it works fine withunicode
objects when chars are in ascii range.All of the test files here on github uses typed
str
objects, so they pass. However if you make an API call using aunicode
object, for example if you change the address as such:u'Nidakule Göztepe, Merdivenköy Mah. Bora Sok. No:1'
it fails while building the pki string (because there are direct string casts likestr(value)
). It only fails when the object contains none ascii chars.We tried converting
unicode
objects tostr
before passing them to API (encoding utf-8), but we still get encode/decode errors because of the multiple casts.In any case, nearly all of the big Python frameworks (like Django) rely on unicode and for a good reason. I believe it would be a much better practice if the API would work with unicode objects without a problem.
Please let us know If you think this error is on our part, if not, can you please add coverage for unicode objects. This problem keeps us stuck.
Looking forward to your guidance. Thank you.
To reproduce the problem