473,385 Members | 1,890 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,385 software developers and data experts.

Starting point for unicode conversion

I *foolishly* started a Python project (3 years ago) with considering
Unicode issues. Now, I want to resolve future problems with international
versions of my software.

The key point here is Tkinter. I believe (from reading this list) that I
can expect that SOME returned text may be Unicode (depending on content and
Windows locale settings).

Would it be best to just (somehow) force all text into Unicode or would it
be "better" to handle specific instances?

I also have the problem of embedded text in data files I create that I have
to store as *something* that I can fully recover and convert back to
something reasonable even if the locale changes.

Any thoughts welcome .... this is something I am NOT looking forward to.

Thanks
Jul 18 '05 #1
1 1653
Howard Lightstone <ho****@eegsoftware.com> writes:
The key point here is Tkinter. I believe (from reading this list) that I
can expect that SOME returned text may be Unicode (depending on content and
Windows locale settings).
Yes, and no. Yes, some returned text may be Unicode, but no, it won't
depend on the locale settings. Instead, Tkinter will return a byte
string if the result contains only ASCII characters, and return a
Unicode string if there are non-ASCII characters.
Would it be best to just (somehow) force all text into Unicode or would it
be "better" to handle specific instances?
If you are prepared to deal with Unicode, it would be best to force
that throughout. I was contemplating to make this an option in
_tkinter, but that has not been implemented - contributions are
welcome.

Meanwhile, you can use

s = unicode(s)

on all strings returned from Tkinter: if s is an ASCII string, the
default encoding should happily convert it to a Unicode object; if s
is a Unicode string, unicode(s) will be a no-op.
I also have the problem of embedded text in data files I create that I have
to store as *something* that I can fully recover and convert back to
something reasonable even if the locale changes.


Don't worry about the locale; it does not matter here.

Regards,
Martin
Jul 18 '05 #2

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

Similar topics

23
by: Hallvard B Furuseth | last post by:
Has someone got a Python routine or module which converts Unicode strings to lowercase (or uppercase)? What I actually need to do is to compare a number of strings in a case-insensitive manner,...
22
by: Keith MacDonald | last post by:
Hello, Is there a portable (at least for VC.Net and g++) method to convert text between wchar_t and char, using the standard library? I may have missed something obvious, but the section on...
0
by: Jonathan | last post by:
I have a unicode database and I basically wish to publish out certain data (via views) from it to a non unicode database. Unfortunately we can not change the type of either of the databases due to...
6
by: New MSSQL DBA | last post by:
Hi all, we are now planning to upgrade our application from a non-unicode version to a unicode version. The application's backend is a SQL Server 2000 SP3. The concern is, existing business...
4
by: djake | last post by:
How can I convert char in wchar_t? And how can I convert wchar_t in char? Thanks to anyone
10
by: Nikolay Petrov | last post by:
How can I convert DOS cyrillic text to Unicode
18
by: Ger | last post by:
I have not been able to find a simple, straight forward Unicode to ASCII string conversion function in VB.Net. Is that because such a function does not exists or do I overlook it? I found...
9
by: mistral | last post by:
Is there some Unicode converter to convert javascript to Unicode format? thanks mistral
0
by: santhescript01 | last post by:
Unicode to non unicode conversion problem -------------------------------------------------------------------------------- Hi All, I am using C dll in macro which converts Unicode data to...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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...

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.