durusmail: quixote-users: Htmltext and latin-1 characters
Htmltext and latin-1 characters
2006-05-10
Mike Orr
Re: [Cheetahtemplate-discuss] Htmltext and latin-1 characters
2006-05-10
Ian Bicking
Re: [Cheetahtemplate-discuss] Htmltext and latin-1 characters
2006-05-11
David Binger
Re: [Cheetahtemplate-discuss] Htmltext and latin-1 characters
2006-05-10
Mike Orr
2006-05-11
David Binger
2006-05-11
Mike Orr
2006-05-11
David Binger
2006-05-11
David Binger
2006-05-11
David Binger
2006-05-13
Akihiro KAYAMA
2006-05-13
Mike Orr
2006-05-15
Akihiro KAYAMA
Re: Htmltext and latin-1 characters
2006-06-04
ak (2 parts)
2006-06-06
Akihiro KAYAMA
2006-06-07
Mike Orr
2006-06-08
Mike Orr
Re: Htmltext and latin-1 characters
2006-06-05
Akihiro KAYAMA
2006-06-05
Mike Orr
2006-06-05
Mike Orr
Htmltext and latin-1 characters
David Binger
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