I am trying to understand the difference between UTF-8, ASCII, and Unicode. I've already read Unicode, UTF, ASCII, ANSI format differences. But I am getting some error from Python and I don't know how I can see which kind of format my string has.
For example:
1# 'Klaus-Groth-Straße, Ballahausen'
2# 'Capit\xe1n\n'
3# u'Capit\xe1n\n'
I surmise that
- 3# = Unicode because of the
u'
? - 1#=?
- 2#=?
I already tried to write string #1 to a file and wrote myself a small function
def escape(html):
html=html.replace('ö','ö')
html=html.replace('Ö','Ö')
html=html.replace('ä','ä')
html=html.replace('Ä','Ä')
html=html.replace('ü','ü')
html=html.replace('Ü','Ü')
html=html.replace('ß','ß')
return html
Before I am going to write my string to a txt
file, I want to replace the letters to get the right spelling in my text file (Klaus-Groth-Straße, Buchholz in der Nordheide).
But it's not working :/
Could you tell me which kind of string my 3 examples belong to - Unicode or ASCII or UTF-8? And how do I write the right spelling to a txt
by using a string like #1?