473,396 Members | 1,775 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

wxPython / Mac / unicode

Hi!
I can not present unicode string in wxPython application

utf-8 string: SomeProductName®

here is how I converted it from iso8859-18
reference = unicode (reference,'iso8859_15').encode('utf-8')

Traceback (most recent call last):
File "/Users/isthar/Documents/Projects/pyEdipEditor/MainFrame.py",
line 417, in OnSelectGen
self.textRef.SetValue( reference )
File
"/BinaryCache/wxWidgets/wxWidgets-2.root~174/System/Library/Frameworks/Python.framework/
Versions/2.3/Extras/lib/python/wx-2.5.3-mac-unicode/wx/_controls.py",
line 1638, in SetValue
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position
25: ordinal not in range(128)

As You see I have unicode version of wx ... so I am in dead end now.

please, ... some clue ... :(

gr, tomek

Jan 4 '06 #1
2 1720
isthar wrote:
Hi!
I can not present unicode string in wxPython application

utf-8 string: SomeProductName®

here is how I converted it from iso8859-18
reference = unicode (reference,'iso8859_15').encode('utf-8')

Traceback (most recent call last):
File "/Users/isthar/Documents/Projects/pyEdipEditor/MainFrame.py",
line 417, in OnSelectGen
self.textRef.SetValue( reference )
File
"/BinaryCache/wxWidgets/wxWidgets-2.root~174/System/Library/Frameworks/Python.framework/ Versions/2.3/Extras/lib/python/wx-2.5.3-mac-unicode/wx/_controls.py",
line 1638, in SetValue
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position
25: ordinal not in range(128)

As You see I have unicode version of wx ... so I am in dead end now.

please, ... some clue ... :(


You are passing a string (encoded in utf-8), not a unicode-object. Thus wx
gets into trouble when trying to decode that string.

Instead of

reference = unicode (reference,'iso8859_15').encode('utf-8')

just do

reference = unicode (reference,'iso8859_15')

And before doing that, do:

for i in xrange(100):
print "UTF-8 is not unicode, its an encoding!"

:)

Regards,

Diez
Jan 4 '06 #2
Hi

I did your loop after ensuring that everything works fine:P
Big Thanks :D

Greets,

Tomek.

Jan 5 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: carroll | last post by:
Does wxPython handle Unicode strings (specifically, Unihan strings, with Chinese characters) easily? I'm writing an app to help me explore the Chinese character sets, and can do basic displays...
13
by: Peter Maas | last post by:
Recently I replaced Win2k with Linux on my desktop computer. Using mostly multi-platform software I thought this would be easy. It was not as easy as expected getting wxPython to work. There seemed...
14
by: Erik Bethke | last post by:
Hello All, I am getting an error of not well-formed at the beginning of the Korean text in the second example. I am doing something wrong with how I am encoding my Korean? Do I need more of a...
1
by: timothy.williams | last post by:
I'm trying to install wxPython 2.5.3.1 using Python 2.3.2 on a Fedora 2 machine. I have python in a non-standard place, but I'm using --prefix with the configure script to point to where I have...
2
by: monkey | last post by:
Hi all, which should be install? Really confused @@... Is that mean unicode version used for programming in language other than English?
4
by: scottholdensmith | last post by:
I'm a little confused. I installed wxPython on my Thinkpad T23, on which I'm running Fedora Core 5. I did it using Yum and Yumex, and everything installed fine. In fact, I now have PyShell and...
8
by: diffuser78 | last post by:
Hi, I wrote a small app using wxPython on a Linux distro called Ubuntu (it is a debain derivative). I ran it on windows and it just worked perfectly. Now, when I am trying to install the same...
4
by: 7stud | last post by:
Hi, I'm using an intel imac which came with python 2.3.5 pre-intstalled on OS 10.4.7. I was able run a hello world wxPython script in Terminal by typing: $pythonw wxPythonTest.py ...
6
by: BartlebyScrivener | last post by:
If there is a wxPython on Debian user in the house? I am using the version of the demo that came with the apt-get download of wxPython. I thought I'd followed the instructions for installing and...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.