473,573 Members | 2,950 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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?


Nov 8 '07 #1
1 1334
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 = 'äöüßÄÜ'
'\xc3\xa4\xc3\x b6\xc3\xbc\xc3\ x9f\xc3\x84\xc3 \x9c'
>>print s

Nov 8 '07 #2

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

Similar topics

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 symbols I am going to use from the wrapper library. The wrapper library has the code written that uses the native classes, and wraps them to present an...
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). This is causing some issues when trying join different tables in a query. How can the correct datatype be defined in Access?
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 assemblies to be executed must be tranlated to native code, the question is: Which is the time of live of the native assemblies? It is possible to...
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 myPicture As New PictureBox() With myPicture myPicture = New System.Windows.Forms.PictureBox()
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);
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 runtime error, " Attempting to call into managed code without transitioning out first. Do not attempt to run managed code inside low-level native...
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
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 form, the first form vanishes when the second form appears. Alternatively, I like to have both showing with just the Access container showing, with...
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# application. My question is: Does the performance of the unmanaged pure native C++ class described above is the same if it was a in a pure unmanaged...
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 InnerException public members. One of these days I'll dig into how to implement a StackTrace property (I assume that this is possible using something...
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main...
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
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 projectplanning, coding, testing, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.