Python Forum
unicode question - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: unicode question (/thread-27719.html)



unicode question - DPaul - Jun-18-2020

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


RE: unicode question - DeaD_EyE - Jun-18-2020

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.


RE: unicode question - DPaul - Jun-18-2020

(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


RE: unicode question - DPaul - Jun-19-2020

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


RE: unicode question - DeaD_EyE - Jun-19-2020

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",



RE: unicode question - DPaul - Jun-19-2020

I installed unifont.ttf, set the IDLE to unifont.
It works !

Thanks !
Paul