Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
unicode question
#1
Hi,I am looking amongst the zillions of unicode chars and I can print them like this.
(I understand that in python 3 the leading "u" is not necessary any more.)
# chess
chess = [u'\u2654', u'\u2655',u'\u2656',u'\u2657',u'\u2658',u'\u2659']
for x in chess:
    print('chess:',x)
#from the dingbats char table
scissors = [u'\u2700']
print(scissors)
Now i turn to the www.unicode.org (new website !),
and i can select chars from tables,
just like the dingbats table i found somewhere.
Only, the many tables on the unicode.org site, seem to code the chars differently.
like so => "1C00" -> this is the first letter in the "Lepcha" language.
When i print(u'\u1C00'), it prints something else.
What is going wrong ?

Paul
It is more important to do the right thing, than to do the thing right.(P.Drucker)
Better is the enemy of good. (Montesquieu) = French version for 'kiss'.
Reply
#2
It works with Python 3.7.3 and 3.8.3:

[deadeye@nexus ~]$ python
Python 3.7.3 (default, May 12 2020, 03:35:19) 
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> print("\u1C00")
ᰀ
>>>
Maybe the Unicode character is missing in the console font which you're using.
Another possible Problem could be the Windows-Terminal vs Windows-Powershell.

And maybe you're using Python 2.7, which does not support all Unicode points.
Almost dead, but too lazy to die: https://sourceserver.info
All humans together. We don't need politicians!
Reply
#3
(Jun-18-2020, 05:31 PM)DeaD_EyE Wrote: It works with Python 3.7.3 and 3.8.3:
Maybe the Unicode character is missing in the console font which you're using.
Another possible Problem could be the Windows-Terminal vs Windows-Powershell.

And maybe you're using Python 2.7, which does not support all Unicode points.
Thanks,
I am using python 3.7.2.
I'll look into this tomorrow, because why would chess pieces work and not Lepcha Smile

Paul
It is more important to do the right thing, than to do the thing right.(P.Drucker)
Better is the enemy of good. (Montesquieu) = French version for 'kiss'.
Reply
#4
I did some testing and i have only observations, no conclusions.
- Upgraded to python 3.8.3 (win 10)
- set the IDLE font to lucinda unicode (also in firefox)

I can do Thai, Sanskrit, you name it, but not Lepcha.
In fact the output from DeaD-Eye (magnified in win10 with ctrl+)
shows a square with IC00 in it. Exactly the unicode number.
I did not test all 100.00 unicodes, and my Lepcha is rusty,
but i would like to know why ...
Paul
It is more important to do the right thing, than to do the thing right.(P.Drucker)
Better is the enemy of good. (Montesquieu) = French version for 'kiss'.
Reply
#5
I tried it today on a Windows 10 machine.

Windows Powershell, Windows Terminal and Idle.
All 3 applications don't show this character with the standard font setting.

You need to use a font, which has these glyphs.
An example with a font, which should have all glyphs: http://www.unifoundry.com/unifont/index.html

If you use the new Terminal App, you've to edit the json file:
"fontFace" : "Unifont",

Attached Files

Thumbnail(s)
           
Almost dead, but too lazy to die: https://sourceserver.info
All humans together. We don't need politicians!
Reply
#6
I installed unifont.ttf, set the IDLE to unifont.
It works !

Thanks !
Paul
It is more important to do the right thing, than to do the thing right.(P.Drucker)
Better is the enemy of good. (Montesquieu) = French version for 'kiss'.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  clean unicode string to contain only characters from some unicode blocks gmarcon 2 3,982 Nov-23-2018, 09:17 PM
Last Post: Gribouillis
  Python 2 Unicode question Skaperen 2 2,490 Sep-08-2018, 06:44 AM
Last Post: Skaperen

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020