On Sep 4, 2011, at 12:13 PM, weheh wrote:
> In the previous post, looks like our google groups app lost the
> improperly translated character. It should have read Espa<?>ol. The <?
> was a white question mark in a black diamond.
That's what I saw.
> With some further experimentation, doing something like this:
>
> response.flash=('Español').decode('latin-1').encode('utf-8')
>
> forces the output to display properly. Seems like a bug.
It sounds like your editor is producing a latin-1-encoded file, and then you're
treating it as utf-8.
If I run this file (generated in BBEdit as a utf-8 file):
#!/usr/bin/env python
# -*- coding: utf-8 -*-
print ('Español')
print ('Español').decode('latin-1').encode('utf8')
print ('Español').decode('utf-8').encode('utf8')
I get this output:
Español
Español
Español
In case that middle line doesn't come through, the ñ has been converted to
A-tilde followed by plus-minus, while the first and third are correct.