Decoding LATIN1 character to ASCII in python 2.7 -



Decoding LATIN1 character to ASCII in python 2.7 -

i getting string website, not sure on encoding. first character in string letter "Î".

i utilize code:

import lxml.html lh import urllib2 import unicodedata url = 'http://www.example.com/' doc = lh.parse(urllib2.urlopen(url)) stoc = doc.xpath('xpath.example') print unicodedata.normalize('nfkd', stoc[0]).encode('ascii', 'ignore')

the problem don't "i" out of "Î", "a". utilize .replace('a','i'), improve method ?

thank you.

python-2.7 character-encoding

Comments

Popular posts from this blog

java - How to set log4j.defaultInitOverride property to false in jboss server 6 -

c - GStreamer 1.0 1.4.5 RTSP Example Server sends 503 Service unavailable -

Using ajax with sonata admin list view pagination -