Message11417

Author jeff.allen
Recipients jeff.allen, stefan.richthofer, tkohn
Date 2017-06-07.08:24:47
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1496823888.21.0.187148988183.issue2596@psf.upfronthosting.co.za>
In-reply-to
Content
I believe I've now fixed this. The defensive coding was a hang-over from problems I'd had when translating the exeption with a busted codec. This is dealt with by other means: I just didn't go back and rip this out.

With a cp936 console that won't encode Ç (C-cedilla), I now see:

>>> umsg = u"\c7a c'est\nune \xc9preuve"
>>> print umsg
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\Jeff\Documents\Eclipse\jython-trunk\h-故乡\d-分配\Lib\encodings\_java.py", line 89, in encode
    _process_encode_errors(self.encoding, input, result, error_function, input_buffer, builder)
  File "C:\Users\Jeff\Documents\Eclipse\jython-trunk\h-故乡\d-分配\Lib\encodings\_java.py", line 243, in _process_encode_errors
    replacement, pos = error_function(e)
UnicodeEncodeError: 'ms936' codec can't encode character u'\xc9' in position 15: illegal multibyte sequence
>>> raise Exception(umsg)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
Exception: \c7a c'est
une \xc9preuve
>>> raise Exception(umsg.encode('cp1252'))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
Exception: \c7a c'est
une \xc9preuve
>>>

Thus the line break is respected and I'm also defended against the encoding errors that motivated the original. This change is now in the trunk at: https://hg.python.org/jython/rev/c558ce4072ee
History
Date User Action Args
2017-06-07 08:24:48jeff.allensetmessageid: <1496823888.21.0.187148988183.issue2596@psf.upfronthosting.co.za>
2017-06-07 08:24:48jeff.allensetrecipients: + jeff.allen, tkohn, stefan.richthofer
2017-06-07 08:24:48jeff.allenlinkissue2596 messages
2017-06-07 08:24:47jeff.allencreate