In a code review I came across the following code:
# Python bug that renders the unicode identifier (0xEF 0xBB 0xBF)
# as a character.
# If untreated, it can prevent the page from validating or rendering
# properly.
bom = unicode( codecs.BOM_UTF8, "utf8" )
r = r.replace(bom, '')
This is in a function that passes a string to Response object (Django or Flask).
Is this still a bug that needs this fix in Python 2.7 or 3? Something tells me it isn't, but I thought I'd ask because I don't know this problem very well.
I'm not sure where this came from, but I've seen it around the Internet, referenced sometimes in association with Jinja2 (which we are using).
Thanks for reading.