utf 8 - How to preserve UTF8 string from app to webserver in Python -


I have an app that submits a request for Python webserver. The app has a UTF 8 string with the following contents:

La Langue franchise PPT

It is placed in an HTTP header, and in any way Has been changed to:

La Lange fan \ xfeaise.ppt

Then the dragon tried to do something with the string on the web server Which might be UTF 8, and I get this error:

Unicodecode error: 'utf8' codec is positioned 14 byte 0xfe D Can not load: invalid start byte

I basically have to protect this UTF 8 from the app on a web server, such as if it can be printed in, then the variables will be the following :

What's the way

\ xfe is for ISO-8859-1 encoding.

While content is utf8 is widely supported, the HTTP header should have ASCII HTTP-Tip ISO-8859-1, but It is not recommended or reliable in tooling. Other encoding is not allowed without special escaping.

If possible, avoid your special characters so that they can be transferred as ASCII. Base 64 suggested by fileoffset is an option, second from quote function to urllib.parse (or urrlib on python2) < / P>


Comments

Popular posts from this blog

sqlite3 - UPDATE a table from the SELECT of another one -

c# - Showing a SelectedItem's Property -

javascript - Render HTML after each iteration in loop -