473,809 Members | 2,710 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 1862
"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
11893
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
1916
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
2941
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
5782
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
3582
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
10640
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...
1
10387
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
10120
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9200
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
7662
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
6881
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4332
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
2
3861
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3015
bsmnconsultancy
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.