is unicode( codecs.BOM_UTF8, "utf8" ) necessary in Python 2.7/3?
- by Brian M. Hunt
In a code review I came across the following code that contains the following:
# 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.
Thanks for reading.