Walter Dörwald <wal...@livinglogic.de> added the comment:

UnicodeEncodeError and UnicodeDecodeError are used to report un(en|de)codedable 
ranges in the source object, so it wouldn't make sense to use them for errors 
that have nothing to do with problems in the source object. Their constructor 
requires 5 arguments (encoding, object, start, end, reason), not just a simple 
message: e.g. UnicodeEncodeError("utf-8", "foo", 17, 23, "bad string").

But for reporting e.g. missing BOMs at the start it would be useful to use (0,  
0) as the offending range.

----------
nosy: +doerwalter

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue41115>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

  • ... Antoine Pitrou
    • ... శ్రీనివాస్ రెడ్డి తాటిపర్తి
    • ... Emmanuel Arias
    • ... Walter Dörwald
    • ... STINNER Victor
    • ... శ్రీనివాస్ రెడ్డి తాటిపర్తి
    • ... utkarsh
    • ... శ్రీనివాస్ రెడ్డి తాటిపర్తి
    • ... utkarsh

Reply via email to