Python string prints as [u’String’]

[u’ABC’] would be a one-element list of unicode strings. Beautiful Soup always produces Unicode. So you need to convert the list to a single unicode string, and then convert that to ASCII. I don’t know exaxtly how you got the one-element lists; the contents member would be a list of strings and tags, which is … Read more

Convert Unicode to ASCII without errors in Python

>>> u’aあä’.encode(‘ascii’, ‘ignore’) ‘a’ Decode the string you get back, using either the charset in the the appropriate meta tag in the response or in the Content-Type header, then encode. The method encode(encoding, errors) accepts custom handlers for errors. The default values, besides ignore, are: >>> u’aあä’.encode(‘ascii’, ‘replace’) b’a??’ >>> u’aあä’.encode(‘ascii’, ‘xmlcharrefreplace’) b’aあä’ >>> u’aあä’.encode(‘ascii’, … Read more

HTML code for an apostrophe

If you are looking for straight apostrophe ‘ (U+00027), it is ' or ' (latest is HTLM 5 only) If you are looking for the curly apostrophe ’ (U+02019), then yes, it is ’ or ’ As of to know which one to use, there are great answers in the Graphic Design community: What’s the … Read more