|
From: James L. <bjl...@lo...> - 2007-01-28 17:05:19
|
James Lockie wrote:
> Thanks.
>
>
> Sean Egan wrote:
> =20
>> I'm sure Amarok provides a mechanism for knowing the
>> encoding of the strings it gives you
>> =20
>
> I have asked on the Amarok maiing list what string format Amarok is=20
> returning. :-)
> =20
I took out the decode and it works for strings without special=20
characters but I get this error for "Bj=F6rk":
message.append(signature=3Dintrospect_sig, *args)
UnicodeError: String parameters to be sent over D-Bus must be valid UTF-8
My guess is Amarok is NOT sending utf8 but decode works for some of the=20
strings but utf8 for other strings. :-(
I'll figure it out. :-)
I was told "Bj=F6rk" can be represented by utf8 but that doesn't seem to=20
be the case.
>
>
> Bartosz Oler wrote:
> =20
>> On 01/28/2007 06:26 AM, James Lockie wrote:
>>
>> [...]
>> =20
>> =20
>>> I am trying to modify the AmarokGaim plugin so that it works with
>>> non-utf8 strings like "Bj=F6rk".
>>>
>>> It calls "message =3D message.decode('utf8')" where message might be =
the
>>> string "Bj=F6rk".
>>> =20
>>> =20
>> [...]
>>
>> The decode() method converts a string into a Unicode string (which is =
just
>> an internal representation and not the thing which you can pass anywhe=
re
>> further). The argument specifies *current* encoding of the string. Thu=
s if
>> you know it's not utf-8 then you should not be giving utf-8 as the arg=
ument.
>> =20
> Mmm.
> I didn't write the original code and I don't know python, gaim or Amaro=
k=20
> so I am trying to figure it out.
> The original code passes utf8 to to decode and it works for strings wit=
h=20
> non-special characters but fails on things like "Bj=F6rk".
>
> I can print out "Bj=F6rk" to the console so the internal representation=
by=20
> python can handle special characters.
> =20
|