I have vectorial data that I have loaded in qgis setting as UTF-8. I was checking if the values of field in atribute table is standartized. So I am creating a script to do it. However, when I print list of field all alfa atributes values are printed so stranged. Look below:
Baixão Lagoa Grande Baixão Mundo Novo Baixão da Bandeira Baixão da Panela Baixão da Planta Baixão da Serra Baixão da Solta Baixão das Queimadas Baixão do Campestre Baixão do Feijão Baixão do Pontal Baixão do Umbuzeiro Baixão do Xique-Xique Baixão dos Caboclos Vereda da Espadeira Vereda da espadeira
I encoded this values to 'latin' and they become well when I print one by one element of my list. For example: Baixão Lagoa Grande.
However I need one list with all of them. So I made this:
idx = l.fieldNameIndex('nome')
values = l.uniqueValues(idx)
lista_nome = []
for v in values:
print str(v.encode(encoding='latin1'))
lista_nome.append(str(v.encode(encoding='latin1')))
print lista_nome
The result has been all characters so messy again, like the firt print that I showed (for example: Baixão Lagoa Grande)
How to correct this characters?