Hartmut Goebel a écrit :
> Jorge Godoy schrieb:
>
> >> Change the order.
> >>
> >>>>> s = u'olá'
> >>>>> s += 'mundo'
> >>>>> s
> >> u'ol\xe1mundo'
> >>>>> s = u'leite com '
> >>>>> s += 'café'
> >> Traceback (most recent call last):
> >>   File "<stdin>", line 1, in ?
> >> UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position
> 3: ordinal not in range(128)
>
This is indeed the typical very annoying feature I was talking about. In
web application, these strings with unicode inside come from the web
requests. Why isn't the string class simply replaced by the unicode
class? Why 2 classes?
> This is correct, since you tell python to add a Unicode-String to an
> Asc-String:
>    s += 'café'
> is the same as
>    s = s + 'café'
>
Ok, but why is the right string encoded into ascii and not into the same
encoding as the left unicode string?
Isn't the += operator an unicode method?
> BTW: Using string-concationation is bad habbit, since it's slow. One
> should prever fthe % operator.
>
Why would % operator would be faster than string concatenation? There is
much less work to do!


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
sqlobject-discuss mailing list
sqlobject-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss

Reply via email to