M
Martin Drautzburg
I am using repr() to pass arrays, dicts and combinations therof to
javascript as it already returns a valid javascript expression (a
string) right away. But for some reason it does not handle Umlaute
correctly and those characters finally appear as two strange characters
on the browser. I am using UTF-8 and assembling the string expression
manually works okay and the umlaute appear correctly in the browser (so
I could probably write my own serializer and it would work).
The commandline shows a difference too:
It works okay for all other chars, just the umlaute seem to be a
problem.
How can I get __repr__() to handle the umlauter correctly, or is there
an easy way to postprocess the output ?
javascript as it already returns a valid javascript expression (a
string) right away. But for some reason it does not handle Umlaute
correctly and those characters finally appear as two strange characters
on the browser. I am using UTF-8 and assembling the string expression
manually works okay and the umlaute appear correctly in the browser (so
I could probably write my own serializer and it would work).
The commandline shows a difference too:
['ö'] <-- this is openbracket quote oumlaut quote closebracketprint "["+"'ö'"+"]"
['\xf6']print ["ö"].__repr__()
It works okay for all other chars, just the umlaute seem to be a
problem.
How can I get __repr__() to handle the umlauter correctly, or is there
an easy way to postprocess the output ?