[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    [PyKDE] QByteArray and unicode
From:       Orcan Ogetbil <orcan () psu ! edu>
Date:       2005-12-23 19:11:47
Message-ID: 200512231411.47754.orcan () psu ! edu
[Download RAW message or body]

Hi,
using the following code, I can get the track title that's being played in 
amarok.

[code]
import dcop

dcopclient = dcop.DCOPClient()
dcopclient.registerAs("amarokapp")
dcopclient.rc = dcop.DCOPRef("amarok", "player")

result = dcopclient.rc.call("title()")
title = result.data.data()

print title
[/code]

The problem is, when the track title contains non-ascii characters, they are 
not displayed properly. 

The 'result' is a QByteArray object, 
'result.data.data()' is a ascii python string

How and where should I set the encoding to display the track title properly? 
(and how do I convert the QByteArray object to a unicode QString object?)


ps: Thx Jim, what you replied to my last email helped a lot!
-- 
Orcan Ogetbil <oogetbil@phys.psu.edu>
Physics Department
Penn State University
814-8637505
211 Osmond Lab

_______________________________________________
PyKDE mailing list    PyKDE@mats.imk.fraunhofer.de
http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic