Why is no working when using encode(‘utf-8′)?

I have this error:

UnicodeEncodeError: ascii codec cant encode character uxa0 in position 20

UnicodeEncodeError: 'ascii' codec can't encode character u'xa0' in position 20: ordinal not in range(128)

So, I use the method to solve the error.
But, string is also garbled.

content = res.read()
with open(wellno + ".html", "w") as f:
    f.write(content)
tree = html.fromstring(content)
txt = ""
for i in range(1,15):
    path = //*[@id="Lab_BasicData"]/table/tr[{0}]/td[2]/text().format(str(i))
    try:
        data = tree.xpath(path)[0].encode(utf-8).strip()
    except:
        data = ""
    txt += data + ,

Result:

enter image description here

update:
I tried to use chardet to detect it encoding.

for i in range(1,15):
    path = //*[@id="Lab_BasicData"]/table/tr[{0}]/td[2]/text().format(str(i))
    data = tree.xpath(path)[0].encode(utf-8)
    result = chardet.detect(data)
    charenc = result[encoding]
    print charenc

Result:
enter image description here

update: I tried to print content. It is normal.

content = res.read()
print content

Result:
enter image description here


Download why.is.no.working.when.using.encodeutf.8.zip
Direct Link


Download


Download why.is.no.working.when.using.encodeutf.8.zip
Mediafire


Download


Download why.is.no.working.when.using.encodeutf.8.zip
Megashares


Download