Oren Tirosh wrote: > Here's another implementation strategy: > [hacking charmap codec] > > Tying it all together: > > A codec that does both charmap and entity reference translations may be > dynamically generated. A function will be registered that intercepts > any codec name that looks like 'xmlcharref.CODECNAME', import that codec, > create patched charmaps and return the (enc, dec, reader, writer) tuple. > The dynamically created entry will be cached for later use. Even though that's possible, why add more magic to the codec registry ? u.encode('latin-1', 'xmlcharrefreplace') looks much clearer to me. You are of course free to write a codec which implements this directly. No change to the core is needed for that. However, PEP 293 addresses a much wider application space than just escaping unmappable characters. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH _______________________________________________________________________ eGenix.com -- Makers of the Python mx Extensions: mxDateTime,mxODBC,... Python Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4