This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author ocean-city
Recipients
Date 2006-07-25.18:46:47
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
Logged In: YES 
user_id=1200846

>>I think the default value for final in mbcs_decode() should
>>be true, so that the stateless decoder detects incomplete
>>byte sequences too.
>
>Probably this is not true. 

Sorry, I lied. Stateless decoder was exactly the thing
you said.

  >>> import codecs
  >>> d = codecs.getdecoder("cp932")
  >>> d('\x82')
  Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
  UnicodeDecodeError: 'cp932' codec can't decode byte 0x82
  in position 0: incomplete multibyte sequence

Problem was on StreamReader. StreamReader should treat
"final" as false, but I didn't change this code,

  class StreamReader(Codec,codecs.StreamReader):
      pass

so StreamReader wrongly treated "final" as True.

I cloned routine from Lib/encoding/utf-8.py. I hope
finally this meets requirement of codec system...

History
Date User Action Args
2007-08-23 15:47:12adminlinkissue1455898 messages
2007-08-23 15:47:12admincreate