Problem on unicode fonts

2574
1
04-21-2015 03:49 AM
H_A_D_Padmasiri
New Contributor

Dear sir!

When I use unicode "SINHALA" (Our local fonts) in Python, It gives me following message

>>> str1 = "මාතා"

Unsupported characters in input

How to solve this Problem

Thanks

Padmasiri

Tags (1)
0 Kudos
1 Reply
ShaunWalbridge
Esri Regular Contributor

Check out Dan Patterson's answer to this question yesterday:

  ascii codec can't encode character u'\xe1' in position 6: ordinal not in range(128)

It's effectively the same issue -- you'll need to declare the file encoding as UTF-8 (or something else that includes Sinhalese within its encoding set), and then tell Python that the strings you're encoding are Unicode by prefixing them with u"", e.g.:

  str1 = u"මාතා"