3 ms·
Allow me to rephrase. I do that operation on a file I get from an API. I know for a fact that the encoding I'm receiving is latin-1. I run exactly that operat
by ianamartin 10y ago
Allow me to rephrase.
I do that operation on a file I get from an API. I know for a fact that the encoding I'm receiving is latin-1.
I run exactly that operation on the file that you wrote out in code.
When I try to read that file back in as UTF-8, I get encoding errors. That does not make for "super good." That makes me want to scream.
I do not have this problem when I use Python 2.7.x
- Sir_Cmpwn 10y agoYou're definitely making a mistake somewhere, because I just tested it for myself and it worked perfectly fine. I made a latin-1 file, applied the above code with it, and got a correct utf-8 file out. Are you reading the final file back as latin-1? You have to read it as utf-8 of course.