F
F
Flam3y2021-06-12 12:04:58
Python
Flam3y, 2021-06-12 12:04:58

How to read unicode character from .txt without broken characters?

I need to read a unicode character from a .txt, but when I try to read the character it gives a strange result.
The code:

txt = open("test.txt","r")
print(txt.read())

Symbol: ▢
Result: in–ў

Answer the question

In order to leave comments, you need to log in

1 answer(s)
W
WolfInChains, 2021-06-12
@Flam3y

txt = open("test.txt", "r", encoding="utf-8")
print(txt.read())

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question