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.

作者 ncoghlan
收信人 ncoghlan
日期 2013-08-23.04:02:31
SpamBayes Score -1.0
Marked as misclassified
Message-id <1377230552.02.0.907422956718.issue18814@psf.upfronthosting.co.za>
In-reply-to
内容
Prompted by issue 18713 and http://lucumr.pocoo.org/2013/7/2/the-updated-guide-to-unicode/, here are some possible utilities we could add to the codecs module to help deal with/debug issues related to surrogate escaped strings:

    def has_escaped_bytes(s):
        """Returns true if string contains surrogate escaped bytes"""
        ...

    def replace_escaped_bytes(s):
        """Replaces each surrogate escaped byte with a valid code point"""
        ...

    def decode_escaped_bytes(s, nominal_encoding, actual_encoding):
        """Reinterprets incorrectly decoded text using a new encoding"""
        return s.encode(nominal_encoding, 'surrogateescape').decode(actual_encoding)
历史
日期 用户 动作 参数
2013-08-23 04:02:32ncoghlan修改recipients: + ncoghlan
2013-08-23 04:02:32ncoghlan修改messageid: <1377230552.02.0.907422956718.issue18814@psf.upfronthosting.co.za>
2013-08-23 04:02:31ncoghlan链接issue18814 messages
2013-08-23 04:02:31ncoghlan创建