473,467 Members | 1,300 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How to overcome automatic cyrillic-to-/hex convert

Hi friends,

I am really sorry to bother you with such a simple stupid question but
today it's my second day spent in searching manuals, mail-archives
(I downloaded over 100MB from "python-list"),
etc., and I could not find anything that can solve the matter.

I am from Bulgaria and I use Python (+wxPython+Boa Constructor) as a
front-end to database processing with Firebird. I use Python 2.4.1 over
Windows 98 SE. My keyboard is set as default Bulgarian keyboard (keybg)
so I can write in Bulgarian using win32 application as well in MS DOS
prompt. That should correspond to 'cp1251' (win32) and 'cp855' (DOS
console) encodings.

But when I enter some Bulgarian (actually cyrillic) text as a string,
it
seems that Python automatically converts it to '\x00..\x00 ' and once
converted that way I can't get it back into its original look. The only
way to get it right is using print :
a = 'ÌÀÌÀ' # 'Mam' in Bulgarian
print a 'ÌÀÌÀ'

but
a

'\xcc\xe0\xec\xe0'

It is not such a great problem that the string enters or gets out of
the
database in that look as long as the user doesn't see it. But when it
comes to data visualization I can't expect the user to know what
'\xcc\xe0\xec\xe0' mean, neither can I use (at least as much as I know)
'print' for that job. To visualize data in the base I use table views
created with wxGrid. In the grid instead of 'ÌÀÌÀ' I am getting
'\xcc\xe0\xec\xe0'.

To set the value of a particular cell in the grid I use
wxGrid::SetCellValue :

self.grid1.SetCellValue(row, column, string)

In one of O'Reilly's Python books (Learning Python, chapter 8.3.2)there
is a hint that it is possible to redirect the standard output to a
user-defined object but it is not quite clear how that can be achived
and if that is applicable in my case at all.

Your help is of great need and would be truely appreciated!

Thank you very much!

degoor
Jul 19 '05 #1
1 2344
<de***********@dir.bg> <de***********@dir.bg> wrote:
But when I enter some Bulgarian (actually cyrillic) text as a string,
it
seems that Python automatically converts it to '\x00..\x00 ' and once
converted that way I can't get it back into its original look. The only
way to get it right is using print :
a = 'ÌÀÌÀ' # 'Mam' in Bulgarian
print a 'ÌÀÌÀ'

but
a

'\xcc\xe0\xec\xe0'

Did you try the locale module?
Florian
--
begin signature_virus
Hi! I'm a signature virus. Please copy me to your signature to help me spread.
end
Jul 19 '05 #2

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

Similar topics

9
by: Joe Hesse | last post by:
/***** When I run the following program (gnu C++) the address of the automatic object 'a' in f() is the same as the address of the automatic object 'b' in main(). I conclude that 'a' in f() is...
0
by: Seff | last post by:
I have input data that contains one field with data that is cyrillic encoded and the other fields are regular ascii data. How do I bcp this into a sql table and how do I display it in VB.
35
by: Philipp Lenssen | last post by:
Does anybody have experience displaying Cyrillic in common browsers with common settings? I found the following page researching the topic, however I cannot display all characters in the table...
1
by: | last post by:
Hi! Can someone tell me can I use MsBuild with NuNit today? Or is MsBuild only available for MSDN subscriptions ? Or what do you use for an automatic build process + automatic NuNit testing....
0
by: sorosh | last post by:
When I send e-mail created using ASP and CDO (not CDONTS) containing serbian cyrillic letters all I get in Outlook is ????????????. Can anyone help me, please?
4
by: Petterson Mikael | last post by:
Hi, Anyone out there that knows of a automatic test generation tool for cpp? Another requirement is that the test results should be presented in xml. All hints appreciated. cheers, ...
3
by: Laurence | last post by:
Hi folks, DB2 UDB supports automatic storage management in v8.2.2 and v9. The question is how do I know the databases and/or tablespaces are enable "automatic storage management" or not after...
5
by: eisenstein | last post by:
i read out an utf-8 xml file with greek or russian/cyrillic characters. i can display it in the browser but if i insert data into an mssql database -field is nvarchar(4000)- i only see ??? or...
1
by: =?Utf-8?B?U2llZ2ZyaWVkIEhlaW50emU=?= | last post by:
I see there is a new feature in C# called automatic properties. Can someone give me a short example of automatic properties in VB? Thanks, Siegfried
4
by: phasma | last post by:
Hi, I'm trying extract all alphabetic characters from string. reg = re.compile('(?u)(+)', re.UNICODE) buf = re.match(string) But it's doesn't work. If string starts from Cyrillic character,...
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
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...
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.