durusmail: quixote-users: Htmltext and latin-1 characters
Htmltext and latin-1 characters
2006-05-10
Re: [Cheetahtemplate-discuss] Htmltext and latin-1 characters
2006-05-10
Re: [Cheetahtemplate-discuss] Htmltext and latin-1 characters
2006-05-11
Re: [Cheetahtemplate-discuss] Htmltext and latin-1 characters
2006-05-10
2006-05-11
2006-05-11
2006-05-11
2006-05-11
2006-05-11
2006-05-13
2006-05-13
2006-05-15
Re: Htmltext and latin-1 characters
2006-06-04
2006-06-06
2006-06-07
2006-06-08
Re: Htmltext and latin-1 characters
2006-06-05
2006-06-05
2006-06-05
Htmltext and latin-1 characters
David Binger
2006-05-11
On May 10, 2006, at 5:15 PM, Mike Orr wrote:

>    return unicode(val.s, 'latin1')  # Cheetah > 1.0rc1 compatibility.
>
> TypeError: decoding Unicode is not supported

This happens to be a case where the htmltext object is
wrapping a unicode instance.  In a case like that, you
just want val.s if you want the unicode instance.

>
> How about this?
>
>    return unicode(val.s)  # Cheetah > 1.0rc1 compatibility.
>
> UnicodeEncodeError: 'ascii' codec can't encode character u'\xa0' in
> position 412: ordinal not in range(128)

Is something calling str() on this return value?
Something not shown here is trying to encode
a str from the unicode instance.


>
> F**k!  OK, the trick I used in TurboGears:
>
>    return unicode(val.s, 'latin1').encode('latin1')  # Cheetah >
> 1.0rc1 compatibility.
>
> TypeError: decoding Unicode is not supported

This looks like the val.s is already a unicode.



reply