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.