S
Steven D'Aprano
I have a string containing Latin-1 characters:
s = u"© and many more..."
I want to convert it to HTML entities:
result =>
"© and many more..."
Decimal/hex escapes would be acceptable:
"© and many more..."
"© and many more..."
I can look up tables of HTML entities on the web (they're a dime a
dozen), turn them into a dict mapping character to entity, then convert
the string by hand. Is there a "batteries included" solution that doesn't
involve reinventing the wheel?
s = u"© and many more..."
I want to convert it to HTML entities:
result =>
"© and many more..."
Decimal/hex escapes would be acceptable:
"© and many more..."
"© and many more..."
I can look up tables of HTML entities on the web (they're a dime a
dozen), turn them into a dict mapping character to entity, then convert
the string by hand. Is there a "batteries included" solution that doesn't
involve reinventing the wheel?