4 ms·
Python already has the "surrogateescape" error handler [0] that performs something similar to what you described: undecodable bytes are translated into unpaired
by LegionMammal978 4y ago
Python already has the "surrogateescape" error handler [0] that performs something similar to what you described: undecodable bytes are translated into unpaired U+DC80 to U+DCFF surrogates. Of course, this isn't standardized in any way, but I've found it useful myself for smuggling raw pathnames through Java.
[0] https://peps.python.org/pep-0383/ https://peps.python.org/pep-0383/
- mmastrac 4y agoThanks for this reference! It's exactly what I was thinking.