[issue13916] disallow the "surrogatepass" handler for non utf-* encodings

2012-01-31 Thread Kang-Hao (Kenny) Lu
New submission from Kang-Hao (Kenny) Lu : Currently the "surrogatepass" handler always encodes the surrogates in UTF-8 and hence the behavior for, say, "\udc80".encode("latin-1", "surrogatepass").decode("latin-1") might be unexpected and I don't even know what would, say, "\udc80\udc80".encode

[issue13916] disallow the "surrogatepass" handler for non utf-* encodings

2012-01-31 Thread STINNER Victor
Changes by STINNER Victor : -- nosy: +haypo ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.

[issue13916] disallow the "surrogatepass" handler for non utf-* encodings

2012-04-27 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- nosy: +storchaka ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.p

[issue13916] disallow the "surrogatepass" handler for non utf-* encodings

2012-04-28 Thread Martin v . Löwis
Martin v. Löwis added the comment: I fail to see the problem. If the error handler does not produce meaningful results in some context, then just don't use it. The whole point of error handlers is that they handle errors; using them shouldn't ever cause errors/exceptions. -- nosy: +l

[issue13916] disallow the "surrogatepass" handler for non utf-* encodings

2012-04-28 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: The problem is that "surrogatepass" specific to utf-8 and there is no standard way to decode alone surrogates in utf-16. >>> "\udc80\udc80".encode("utf-16", "surrogatepass").decode("utf-16", >>> "surrogatepass") Traceback (most recent call last): File "",

[issue13916] disallow the "surrogatepass" handler for non utf-* encodings

2012-04-28 Thread Martin v . Löwis
Martin v. Löwis added the comment: I see. The proper reaction for a codec that can't handle a certain error then is to raise the original exception. I'm -1 on raising LookupError when trying to find the error handler - this would suggest that the error handler does not exist, which is not tru