473,834 Members | 1,913 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

writing unicode apps in python - some beginner questions.

WX
I love Python, and the unicode support is wonderful.

The character set I am using is the Hindi/Devanagari character set at
unicode range U+901.)

I have TWO newbie questions:

(#1) If I paste some unicode stuff from the clipboard into IDLE, it
accepts it, but it can't execute a PRINT command like this:
print u"हिन् ी सिखिय ए"

Unsupported characters in input

Should I report this as a bug or is it an essential limitation of the
Python console/immediate mode?

(#2) Hindi is not displayed correctly on the screen when the
"Suplementa l language support" parts for Windows XP are not installed,
in particular in the Regional and Languages Options panel in the
Control Panel, you have to check "Install files for complex script and
right-to-left languages (including Thai)". This adds Thai, and Indic
language support. Does anyone know a programmatic way in Python to
check for this,so I can pop up a message telling users that support for
this script hasn't been installed in Windows?

Regards,

Warren
Jul 18 '05 #1
4 1864
"WX" wrote:
The character set I am using is the Hindi/Devanagari character set at
unicode range U+901.)

(#1) If I paste some unicode stuff from the clipboard into IDLE, it accepts it, but it can't
execute a PRINT command like this:
print u"?????? ??????"

Unsupported characters in input

Should I report this as a bug or is it an essential limitation of the Python console/immediate
mode?


I don't see why it couldn't be fixed, so feel free to report it to the bug tracker.

</F>

Jul 18 '05 #2
Hi!

XP unicode view depend, also, of the uniscribe motor version. The last
version come with SP-2.
Other element : is the font "Arial Unicode MS" installed ?

@-salutations
--
Michel Claveau
Jul 18 '05 #3
WX wrote:
(#2) Hindi is not displayed correctly on the screen when the
"Suplementa l language support" parts for Windows XP are not installed,
in particular in the Regional and Languages Options panel in the
Control Panel, you have to check "Install files for complex script and
right-to-left languages (including Thai)". This adds Thai, and Indic
language support. Does anyone know a programmatic way in Python to
check for this,so I can pop up a message telling users that support
for this script hasn't been installed in Windows?


I suspect it's hidden in the windows registry. To find out where it's
hidden try the following:
1. Before installing supplemental language support export
HKEY_LOCAL_MACH INE\SYSTEM\Curr entControlSet\C ontrol\Nls
into a text file using regedit
2. Install supplemental language support
3. Export the same registry branch into another file and compare with
the first file.

If there are no changes try doing the same for other registry branches:
HKEY_LOCAL_MACH INE\SOFTWARE\Mi crosoft\Windows
HKEY_LOCAL_MACH INE\SYSTEM\

After you find out what's going on you can use python's module
_winreg to read the registry from your python program. Good luck.

Serge.


Jul 18 '05 #4
WX wrote:
(#2) Hindi is not displayed correctly on the screen when the
"Suplementa l language support" parts for Windows XP are not installed,
in particular in the Regional and Languages Options panel in the
Control Panel, you have to check "Install files for complex script and
right-to-left languages (including Thai)". This adds Thai, and Indic
language support. Does anyone know a programmatic way in Python to
check for this,so I can pop up a message telling users that support
for this script hasn't been installed in Windows?


In addition to my previous post you can try the following, more
simple method: try calling setlocale, if Thai support is installed I suspect
you won't get an exception:
import locale
locale.setlocal e(locale.LC_ALL ,'English') 'English_United States.1252' locale.setlocal e(locale.LC_ALL ,'Russian') 'Russian_Russia .1251' locale.setlocal e(locale.LC_ALL ,'Thai')

Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "C:\Python24\li b\locale.py", line 379, in setlocale
return _setlocale(cate gory, locale)
locale.Error: unsupported locale setting

Serge.

Jul 18 '05 #5

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

Similar topics

8
7092
by: sebastien.hugues | last post by:
Hi I would like to retrieve the application data directory path of the logged user on windows XP. To achieve this goal i use the environment variable APPDATA. The logged user has this name: sbastien. The second character is not an ascii one and when i try to encode the path that contains this name in utf-8,
19
11901
by: Gerson Kurz | last post by:
AAAAAAAARG I hate the way python handles unicode. Here is a nice problem for y'all to enjoy: say you have a variable thats unicode directory = u"c:\temp" Its unicode not because you want it to, but because its for example read from _winreg which returns unicode. You do an os.listdir(directory). Note that all filenames returned are now unicode. (Change introduced I believe in 2.3).
3
17626
by: Michael Weir | last post by:
I'm sure this is a very simple thing to do, once you know how to do it, but I am having no fun at all trying to write utf-8 strings to a unicode file. Does anyone have a couple of lines of code that - opens a file appropriately for output - writes to this file Thanks very much. Michael Weir
4
1917
by: Guilherme Salgado | last post by:
Hi there, I have a python source file encoded in unicode(utf-8) with some iso8859-1 strings. I've encoded this file as utf-8 in the hope that python will understand these strings as unicode (<type 'unicode'>) strings whithout the need to use unicode() or u"" on these strings. But this didn't happen. Am I expecting something that really shoudn't happen or we have a bug?
7
4207
by: Robert | last post by:
Hello, I'm using Pythonwin and py2.3 (py2.4). I did not come clear with this: I want to use win32-fuctions like win32ui.MessageBox, listctrl.InsertItem ..... to get unicode strings on the screen - best results according to the platform/language settings (mainly XP Home, W2K, ...). Also unicode strings should be displayed as nice as possible at the console with normal print-s to stdout (on varying platforms, different
2
2943
by: Yury | last post by:
I am new to python and programming generally, but someday it is time to start :) I am writing a python module in C and have a question about multibyte character strings in python<=>C. I want a C function which takes a string as argument from python script: static PyObject * connect_to_server(PyObject *self, PyObject * authinfo){ wchar_t * login; /* Must support unicode */
2
2129
by: enquiring mind | last post by:
I read the posting by Rehceb Rotkiv and response but don't know if it relates to my problem in any way. I only want to write German to the screen/console for little German programs/exercises in python. No file w/r will be used. #! /usr/bin/env python # -*- coding: utf-8 -*- # Filename: 7P07png.py # SUSE Linux 10 Python 2.4.1 gedit 2.12.0
1
5786
by: anonymous | last post by:
1 Objective to write little programs to help me learn German. See code after numbered comments. //Thanks in advance for any direction or suggestions. tk 2 Want keyboard answer input, for example: answer_str = raw_input(' Enter answer ') Herr
20
3585
by: Marin Brkic | last post by:
Hello all, please, let me apologize in advance. English is not my first language (not even my second one), so excuse any errors with which I'm about to embarass myself in front of the general public. Second, I'm relatively new to python, so sorry if this seems like a stupid question. I'm trying to find a way to write data to excel cells (or to be more specific to an .xls file), let's say for the sake of argument, data readen from a...
0
9646
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10795
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10512
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10550
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
9332
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 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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7760
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 presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5627
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5796
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4427
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 we have to send another system

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.