Non-ASCII character issue with Kivy

660 views
Skip to first unread message

citt...@gmail.com

unread,
Jan 13, 2014, 6:04:20 AM1/13/14
to kivy-...@googlegroups.com
Hi,

I'm programming a Tibetan language app.
Therefore I would need to display Non-ASCII characters in the App.
When Kivy first encountered the Non-ASCII character in the App, it produced an error:

SyntaxError: Non-ASCII character '\xe0' in file tibetanphonetics.py on line 39, but no encoding declared; see http://www.python.org/peps/pep-0263.html for details


I then googled about this Error and found out that I can put the following code on top of my file:

# -*- coding: utf-8 -*-


After putting that code on top of my file, I no longer get the SyntaxError.
However, the character does not get displayed properly as well.
Instead of the character being displayed, I get a rectangle......

Is it impossible to get Kivy to work with Tibetan Characters?
Or is there a way around this?
How should I go about solving this?
Is Kivy the wrong tool for this?

I've attached a print screen image.  You will see rectangles in the image.  Those are the Tibetan characters that are not showing right....

Thank you


Screen Shot 2014-01-13 at 7.03.42 PM.png

Alexander Taylor

unread,
Jan 13, 2014, 8:00:19 AM1/13/14
to kivy-...@googlegroups.com
I think the direct reason is that kivy's default font doesn't have these characters. You should be able to use your own font, as documented at the Label's font_name property (http://kivy.org/docs/api-kivy.uix.label.html#kivy.uix.label.Label.font_name). As long as you have a ttf for the font, you can just set that to the right filepath.

citt...@gmail.com

unread,
Jan 16, 2014, 6:39:10 AM1/16/14
to kivy-...@googlegroups.com
Hi
Thank you, this did work for me..
Reply all
Reply to author
Forward
0 new messages