Encoding Error
Brought to you by:
drpython
DrPython 3.10.2 on WinXP.
Tpye the following:
# -*- coding: latin-1 -*-
print "hellö" # (German umlaut ö = oe)
Now select File -> Save. You get the following error
message:
Traceback (most recent call last):
File
"C:\Programme\Python\Lib\site-packages\drpython\drpython.py",
line 3016, in SaveFile
ctext = drEncoding.DecodeText(self,
self.txtDocumentArray[docPos].GetText(), encoding)
File
"C:\Programme\Python\Lib\site-packages\drpython\drEncoding.py",
line 120, in DecodeText
raise Exception, 'Encoding Error!'
Exception: Encoding Error!
Logged In: YES
user_id=796750
This isn't a bug, it is a feature!
Yes, you need to set the encoding via either preferences, or
the save as dialog.
I've extended auto-detect for the next release, so
in the future, this will be autodetected.
Logged In: YES
user_id=193957
Thanks for the hint. Setting it in the preferences worked
for me. However, sometimes I use utf-8, sometimes latin-1,
sometimes nothing. So an autodetect feature would be really
nice. It should regard PEP 263, and if nothing is declared
use ascii, or utf-8 when the document contains any non-ascii.
> This isn't a bug, it is a feature!
Didn't you say you're not Microsoft? ;-)
"Save as" is not sufficient, by the way. Even if I save as
latin-1, I will get the error when I load it next time and
haven't set a preference, because this changes actually
nothing to the document.