How to savely store unicode in a potentially huge and often changed file | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

How to savely store unicode in a potentially huge and often changed file

My vocabulary-learning script does some strange things. One of them is: Umlauts, asian symbols or other unicode stuff sometimes isn't stored correctly, it comes back distorted when I reaccess the file. How can I reliably prevent this? Up to now I have used txt-files and py-files (because txt doesn't seem to work on android). What would be the best simple solution? Some kind of encoding? Pickle? Something else?

15th Jun 2018, 10:23 AM
HonFu
HonFu - avatar
1 Answer
+ 1
pass the binary write as a second arguemant e.g: file = open('langs.html', 'wb')--> when writing to file file = open('langs.html', 'rb')--> when reading from file
15th Jun 2018, 8:57 PM
ghali lawal
ghali lawal - avatar