ladon failed to return texts with strange characters

Asked by Mr T on 2013-11-15

An exception ocurred when trying to encode some string with invalid characters.

Question information

Language:
English Edit question
Status:
Solved
For:
ladon Edit question
Assignee:
No assignee Edit question
Solved by:
Mr T
Solved:
2013-11-15
Last query:
2013-11-15
Last reply:
Mr T (mrjaspe) said : #1

Although it could be a responsability for the app developer to properly encode all the strings his services might return, this can be solved within ladon by modifying the typeconverter.py (at /opt/amiga4gas/environments/env2.7/lib/python2.7/site-packages/ladon/types/typeconverter.py) file at the function "to_unicode_string":

...

elif typ==PORTABLE_BYTES:
        #val = PORTABLE_STRING(val,self.encoding)
        #Fix for dealing with strange characters
        val = PORTABLE_STRING(val,self.encoding,errors='replace')
else:
        #val = PORTABLE_STRING(val)
        #Fix for dealing with strange characters
        val = PORTABLE_STRING(val,errors='replace')

...