473,289 Members | 2,106 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,289 software developers and data experts.

Showing native 8-bit strings in Python interpreter

I'm storing 8-bit characters from the 128-256 range in Python
strings. They are Windows CP1251 Russian characters. When looking at
those strings in the Python interpreter, they come up as codes inside
the string. How can I teach Python to show those 8-bit characters in
the native encoding of the terminal -- in the current locale -- where
the interpreter was started?

Cheers,
Alexy

Nov 8 '07 #1
1 1322
braver wrote:
I'm storing 8-bit characters from the 128-256 range in Python
strings. They are Windows CP1251 Russian characters. When looking at
those strings in the Python interpreter, they come up as codes inside
the string. How can I teach Python to show those 8-bit characters in
the native encoding of the terminal -- in the current locale -- where
the interpreter was started?
The python-interpreter will print them out using hex because it calls
repr(string) - to prevent any encoding-related troubles.

But printing them will meet your expectations. See below:

Python 2.5.1 (r251:54863, May 2 2007, 16:56:35)
>>s = 'äöüßÄÜ'
s
'\xc3\xa4\xc3\xb6\xc3\xbc\xc3\x9f\xc3\x84\xc3\x9c'
>>print s
äöüßÄÜ
>>>

Diez
Nov 8 '07 #2

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

Similar topics

4
by: David Kantowitz | last post by:
I am trying to wrap a native-C++ DLL in managed C++, to use in a .NET project. The native code is compiled into a DLL, and I have created a .def file that exports the mangled names of the...
6
by: robin9876 | last post by:
In an Access 97 (and 2000) database that has linked tables to Oracle which is showing some fields as text when they are numbers in Oracle. In Oracle they are specified to a size e.g. Number(38)....
3
by: Xavi Sam | last post by:
Hi When I build my asp.net application the ASP.NET generates a net.assembly by page in the directory of my pc: C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET Files Theese...
22
by: Andy Chan | last post by:
I'm trying to dynamically add a picturebox control to a form. I'm following some coding I see in the form designer generated code: ....and so far....nothing. Any help is appreciated. Dim...
9
by: Herby | last post by:
Is possible to have a managed method within a Native(un-managed) class within a \clr project? E.g. class myClass { public: #pragma managed void myMethod(void);
3
by: Lonewolf | last post by:
Hi all, I'm having difficulties passing data back to managed class from my native class when the data is generated from within a native thread in the native class itself. I will give the following...
8
by: Gary Nastrasio | last post by:
If I compile with /clr:safe, which is exactly meant by saying I can't use "Native Types" in my code? Is a native type something such as float, short, or int? Thanks, Gary
15
missinglinq
by: missinglinq | last post by:
I'd like to use acCmdAppMinimize with two forms on the screen at once. Currently, if I have a form opening the db (with DoCmd.Maximize in the OnLoad event) and then a popup form on top of the first...
5
by: =?Utf-8?B?U2hhcm9u?= | last post by:
I have a class that is writen in unmanaged pure native C++. This class files (h and cpp) are inserted to a managed C++ (VC++ 2005, C++/CLI) DLL compoenet. This DLL compoenet is used in a C#...
2
by: Bob Altman | last post by:
Hi all, We have a native class modeled after the System::Exception class, and all exceptions that we throw derive from this class. For now this class is quite simple: just Description and...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...

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.