Update of /cvsroot/pywin32/pywin32/Pythonwin/pywin/scintilla
In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv7020/Pythonwin/pywin/scintilla
Modified Files:
document.py
Log Message:
Warn about invalid encoding names and warn not to save the file (bug 3137807)
Index: document.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/scintilla/document.py,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** document.py 27 Oct 2010 04:23:48 -0000 1.12
--- document.py 17 Dec 2010 23:37:51 -0000 1.13
***************
*** 126,130 ****
dec = text.decode(source_encoding)
except UnicodeError:
! print "WARNING: Failed to decode bytes from %r encoding - treating as latin1" % source_encoding
dec = text.decode('latin1')
# and put it back as utf8 - this shouldn't fail.
--- 126,135 ----
dec = text.decode(source_encoding)
except UnicodeError:
! print "WARNING: Failed to decode bytes from '%s' encoding - treating as latin1" % source_encoding
! print "WARNING: Do not modify this file - you will not be able to save it."
! dec = text.decode('latin1')
! except LookupError:
! print "WARNING: Invalid encoding '%s' specified - treating as latin1" % source_encoding
! print "WARNING: Do not modify this file - you will not be able to save it."
dec = text.decode('latin1')
# and put it back as utf8 - this shouldn't fail.
|