User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Python section within the Software Development category of DaniWeb, a massive community of 361,894 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,295 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Python advertiser:
Views: 2143 | Replies: 5
Reply
Join Date: Aug 2005
Location: Bosnia and Herzegovina
Posts: 146
Reputation: Micko is on a distinguished road 
Rep Power: 3
Solved Threads: 1
Micko Micko is offline Offline
Junior Poster

Handle unicode characters

  #1  
Aug 20th, 2005
Hello, I've downloaded PythonWin as a better IDE for writing Python code.
I came across an interesting issue (as vegaseat pointed out)
When I try to write this sentence in my native language
"Ja sam Ä?iÄ?a Ä?vorak!"
PythonWin automatically convert my language's charater to something other because it cannot handle them. However if I start Python default IDE (which came with installer - IDLE) this code works fine

# -*- coding: cp1250 -*-
str1 = u"Ja sam Ä?iÄ?a Ä?vorak!"
print str1 

How this is possible? Do IDE's yuse different font or what?
HOW IT IS POSSIBLE THAT ONE EDITOR SHOWS CORRECT CHARACTER AND OTHER DOESN'T?
I must admit that I don't understand how to use UNICODE and will UNICODE will help at all?

if I copy that changed text form PythonWin and paste it here changed characters are back again in what I've expected.

Maybe because of your windows local settings you cannot see exact characters, that's why I send two pictures.

I hope someony can clearfy this

Thanks
Attached Images
File Type: jpg Changed_pythonWin.jpg (8.6 KB, 3 views)
File Type: jpg Correct_IDLE.jpg (10.5 KB, 4 views)
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Jul 2005
Location: France
Posts: 914
Reputation: bumsfeld is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 40
bumsfeld's Avatar
bumsfeld bumsfeld is offline Offline
Posting Shark

Solution Re: Handle unicode characters

  #2  
Aug 20th, 2005
I thinks IDLE uses Tkinter (TCL) and that is more internationally than PyWin's wxPython based code.

If you want portability of your code on the internet, don't use these special characters. I have the same problem with other non-english characters too.
Reply With Quote  
Join Date: Oct 2004
Location: Mojave Desert
Posts: 2,275
Reputation: vegaseat is on a distinguished road 
Rep Power: 8
Solved Threads: 167
Moderator
vegaseat's Avatar
vegaseat vegaseat is offline Offline
Kickbutt Moderator

Solution Re: Handle unicode characters

  #3  
Aug 20th, 2005
I think just to start out with any computer language, the foreign character issue is hot tar on the road to progress. As a beginner, try to do without it for a while.

The following should scare anybody. ASCII admittedly is only a 7-bit character set (0 to 127), originally defined for the American dialect. The basic 8-bit extension (128 to 255) is considered to be the international standard ISO 8859-1.

This standard is adulterated with other ISO sets for other languages and many proprietary 8-bit sets. The Microsoft set is different than IBM and so on.

The ISO standard that does not define characters 0-31 and 127-159. The Microsoft 8-bit characters set is close but is not the same as ISO 8859-1 which explains the difference between wxWindows (Unix) and Windows.

There is detailed information at:
http://www.cs.tut.fi/~jkorpela/chars.html

All in all an imperfect computer world, unicode with up to 64,000 characters should ultimately come to the rescue.
May 'the Google' be with you!
Reply With Quote  
Join Date: Aug 2005
Location: Bosnia and Herzegovina
Posts: 146
Reputation: Micko is on a distinguished road 
Rep Power: 3
Solved Threads: 1
Micko Micko is offline Offline
Junior Poster

Re: Handle unicode characters

  #4  
Aug 21st, 2005
Thank you very much
Reply With Quote  
Join Date: Oct 2004
Location: Mojave Desert
Posts: 2,275
Reputation: vegaseat is on a distinguished road 
Rep Power: 8
Solved Threads: 167
Moderator
vegaseat's Avatar
vegaseat vegaseat is offline Offline
Kickbutt Moderator

Solution Re: Handle unicode characters

  #5  
Aug 25th, 2005
Here is another web site that deals with unicode in Python:
http://www.amk.ca/python/howto/unicode
May 'the Google' be with you!
Reply With Quote  
Join Date: Aug 2005
Location: Bosnia and Herzegovina
Posts: 146
Reputation: Micko is on a distinguished road 
Rep Power: 3
Solved Threads: 1
Micko Micko is offline Offline
Junior Poster

Re: Handle unicode characters

  #6  
Aug 25th, 2005
Originally Posted by vegaseat
Here is another web site that deals with unicode in Python:
http://www.amk.ca/python/howto/unicode

Thank you vegaseat, it seems you're becoming my personal tutor
Cheers
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb Python Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the Python Forum

All times are GMT -4. The time now is 8:17 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC