![]() |
2010-06-28
, 21:43
|
Posts: 3,617 |
Thanked: 2,412 times |
Joined on Nov 2009
@ Cambridge, UK
|
#2
|
The Following User Says Thank You to Rob1n For This Useful Post: | ||
![]() |
2010-06-28
, 23:21
|
|
Posts: 267 |
Thanked: 408 times |
Joined on May 2010
@ Austria
|
#3
|
![]() |
2010-07-12
, 16:13
|
Posts: 56 |
Thanked: 31 times |
Joined on Jul 2008
@ Austria
|
#4
|
![]() |
2010-07-12
, 16:58
|
Posts: 70 |
Thanked: 39 times |
Joined on Mar 2010
|
#5
|
encoding = "utf-8" decoded = encoded.decode(encoding) qStr = QString("Decoded: %s", decoded)
The Following User Says Thank You to cheungs For This Useful Post: | ||
![]() |
2010-07-12
, 22:26
|
|
Posts: 267 |
Thanked: 408 times |
Joined on May 2010
@ Austria
|
#6
|
unicode(QString.fromUtf8(lang.gettext(filetxt)).toUtf8(), "utf-8")
I have a problem with handling non-ascii characters in python and was wondering whether one of the Python buffs could help me out. Here's the problem:
(For my application menu folder application) I would like to offer the user a way to enter names for their folders that include non-ascii characters. Entering them in a widget works fine, but as soon as I try to work with the string (for which I think I HAVE to convert it into a QString?), things get nasty. It works fine when I get rid of the non-ascii chars beforehand, but this results in a rather crippled, non-international functionality.
Same with reading application names. As soon as my scripts run into a name that features non-ascii characters, it simply ignores the entry and jumps right to the next one.
Is there any way to deal with non-ascii characters in Python OTHER than simply getting rid of them?
Thanks in advance!