Still cant figure out how to solve my problem :(

However i get my data like this from  return response.json(res)

q='["2211052870 BITWORK - SERVI\\u00c7OS DE INFORM\\u00c1TICA  ",
"2211051448 COMBITRANS TRANSIT\\u00c1RIOS, LDA.      ", "2211050146 OITO
BITS - INFORM\\u00c1TICA, LDA.      ", "2211052568
PROBITAS-COM\\u00c9R.COMPUTAD.SERVI\\u00c7.LDA ", "2211052981
\\u00d3RBITA-BICICLETAS PORTUGUESAS, LDA."]'

then i eval(q)

The strange is that if i do eval(q) with python3 i get it properly decoded
['2211052870 BITWORK - SERVIÇOS DE INFORMÁTICA  ', '2211051448 COMBITRANS
TRANSITÁRIOS, LDA.      ', '2211050146 OITO BITS - INFORMÁTICA, LDA.
', '2211052568 PROBITAS-COMÉR.COMPUTAD.SERVIÇ.LDA ', '2211052981
ÓRBITA-BICICLETAS PORTUGUESAS, LDA.']

however my app is still in python 2.7 and i get when eval(q)
['2211052870 BITWORK - SERVI\\u00c7OS DE INFORM\\u00c1TICA  ', '2211051448
COMBITRANS TRANSIT\\u00c1RIOS, LDA.      ', '2211050146 OITO BITS -
INFORM\\u00c1TICA, LDA.      ', '2211052568
PROBITAS-COM\\u00c9R.COMPUTAD.SERVI\\u00c7.LDA ', '2211052981
\\u00d3RBITA-BICICLETAS PORTUGUESAS, LDA.']

Any help ?

regards



Em seg, 24 de dez de 2018 às 04:38, Armando Hernandez <
[email protected]> escreveu:

> this is the best article i have read about Unicode and characters sets:
>
>
> https://www.joelonsoftware.com/2003/10/08/the-absolute-minimum-every-software-developer-absolutely-positively-must-know-about-unicode-and-character-sets-no-excuses/
>
>  ;)
>
>
>
> El viernes, 21 de diciembre de 2018, 10:27:00 (UTC-6), Ramos escribió:
>>
>> Hello i have this var in my code after reading a webservice.
>>
>> x='OITO BITS - INFORM*\xc1*TICA, LDA. '
>>
>> i want to return from my controller
>> 'OITO BITS - INFORM*Á*TICA, LDA. '
>>
>>
>> this is my relevant code
>> res=[]
>> x='OITO BITS - INFORM*\xc1*TICA, LDA. '
>> z=x.encode('latin-1')
>> print z   >>>> it prints    'OITO BITS - INFORM*Á*TICA, LDA. '
>> res.append(x) >>> if i replace x with z i get the error below
>> return response.json(res)
>>
>>
>>
>> UnicodeDecodeError: 'ascii' codec can't decode byte 0xc1 in position 18: 
>> ordinal
>> not in range(128)
>> Any help ???
>>
>> regards
>> António
>>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to