I think you're on to it, Jonathan. But I keep getting an maddening
behavior in Eclipse.

I have Eclipse's Edit > Set Encoding set to UTF-8. I have
response.flash='Español'. I actually see Español with my real app.

I went over to the test case, which I had created with the web2py
interface and edited in vim, and now I loaded it into Eclipse. I saw
that the body of the code had Espa<?>ol in it, not Español as
originally typed. I changed it to Español and now it prints as
Español, thank heavens. In the same Eclipse session, I go back to my
real app and once again type response.flash='Español' but it still
comes out Español. How can that be?

On Sep 4, 4:21 pm, Jonathan Lundell <[email protected]> wrote:
> 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.

Reply via email to