On 1/13/21 7:57 PM, n952162 wrote:
On 1/13/21 7:31 PM, n952162 wrote:
Hello. In python3, how do you do this?
tgt = 'gebuchte Umsätze;'
In python2, you could do this:
tgt = unicode ('gebuchte Umsätze;'.decode ('latin1'))
but that gives:
SyntaxError: (unicode error) 'utf-8' codec can't decode byte 0xe4 in
position 12: invalid continuation byte
In fact, any constant with ä in it will give you that.
Okay, I see that if your locale is not C, you can do:
tgt = 'gebuchte Umsätze;'
Okay, I see I had this bit of magic in line 2:
# -*- coding: utf-8 -*- [ this has to be in line1 or line2!!! ]
I've removed that and the error msg is somewhat different:
SyntaxError: Non-UTF-8 code starting with '\xe4' in file test.py on line
89, but no encoding declared; see http://python.org/dev/peps/pep-0263/
for details
Note that line 89 is a *comment* (with a ä)
So, I'm looking into that...
Oh, I think that gave me a solution!
# -*- coding: latin1 -*- [ this has to be in line1 or line2!!! ]
seems to work. At least, I got some other errors now ;-)