You Are Here:

Community: Developer Discussion Boards

#1 Old Font & National Code - 2006-06-28, 09:09

Join Date: Jun 2006
Posts: 6
dboyko
Offline
Registered User
Hi!
When I use English in the statement like this
note (u'Hello World!','info') It os OK.
But when I use my national font. I have abrakadabra.
note (u'ПРЕВЕД!','info')

What I must do to get rigth the text for normal view?
Reply With Quote

#2 Old Re: Font & National Code - 2006-06-28, 10:44

Join Date: May 2004
Posts: 524
Location: Tampere, Finland
jethro.fn's Avatar
jethro.fn
Offline
Forum Nokia Champion
Ah, welcome to the wonderful world of character sets.

Python v2.3 introduced a way to select the source file encoding, like this:

Code:
#!/usr/bin/python
# -*- coding: utf8 -*-

print u"<UNICODE CHARACTERS, ENCODED IN UTF-8>"
See PEP 0263 for details: http://www.python.org/dev/peps/pep-0263/

Unfortunately this does not work in Python v2.2, which is the version Python for S60 has. Your editor probably uses UTF-8 or some national character set encoding. Python v2.2 expects ISO-8859-1 characters inside Unicode literals, so you cannot directly use text in your language inside Python for S60 programs. It needs to be expressed using unicode escapes:

Code:
import appuifw

appuifw.note(u"\u041f\u0420\u0415\u0412\u0415\u0414!", "info")
See these Unicode tables for correct character escapes: http://www.unicode.org/charts/

More information about UTF-8: http://en.wikipedia.org/wiki/Utf-8
Reply With Quote

#3 Old Re: Font & National Code - 2006-06-28, 20:05

Join Date: Aug 2004
Posts: 290
simo.salminen
Offline
Regular Contributor
You can of course place the texts inside some other file, and read them from there: open("texts.txt").read().decode("utf-8")
Reply With Quote

#4 Old Re: Font & National Code - 2006-06-29, 06:26

Join Date: Jun 2006
Posts: 6
dboyko
Offline
Registered User
Thank u for professional help! It is work good.
Reply With Quote

#5 Old Re: Font & National Code - 2006-07-06, 01:31

Join Date: Jun 2006
Posts: 40
saad1396
Offline
Registered User
hi everybody

sorry for newbies question...

would it work with arabic characters ? (on an n-gage)

thanks

bye bye
Reply With Quote

#6 Old Re: Font & National Code - 2008-06-19, 12:41

Join Date: Oct 2007
Posts: 3
OsaMa-88
Offline
Registered User
this is works

but assume i want to write 1000 char

by this way
u041f\u0420\u0415\u0412\u0415\u0414

i will die before writing my program
Reply With Quote

#7 Old Re: Font & National Code - 2008-06-19, 13:35

Join Date: Dec 2007
Posts: 409
Location: Tempe, AZ
Send a message via Yahoo to shubhendra Send a message via Skype™ to shubhendra
shubhendra's Avatar
shubhendra
Offline
Forum Nokia Champion
I think you should write (the arabic part) into a file and run a script to convert whatever is written in file to UTF-8.

Then just paste these into your PyS60 code.


IDEAS is all they need but still they think only Genius can give them that.
Reply With Quote

#8 Old Re: Font & National Code - 2008-06-19, 14:53

Join Date: Dec 2007
Posts: 409
Location: Tempe, AZ
Send a message via Yahoo to shubhendra Send a message via Skype™ to shubhendra
shubhendra's Avatar
shubhendra
Offline
Forum Nokia Champion
So i tried this program and it is giving error

Code:
import appuifw

abc=u"ПРЕВЕД"
	 
for c in abc:
	print ord(c)
And i saved this file with encoding as "UTF-8" (Previously tried with "UTF" also but same error)

ERROR was

Quote:

Traceback (most recent call last): File "Z:\SYstem\Apps|python\default.py", line 81, in menu_action
f()
File "Z:\SYstem\Apps|python\default.py", line 65 in query_and_exec execfile(script_list[index][1].encode("utf-8"),script_namespace.namespace)
File "Z:\SYstem\Apps|python\unicode_try.py", line 1


IDEAS is all they need but still they think only Genius can give them that.
Reply With Quote

#9 Old Re: Font & National Code - 2008-06-20, 09:07

Join Date: Dec 2007
Posts: 409
Location: Tempe, AZ
Send a message via Yahoo to shubhendra Send a message via Skype™ to shubhendra
shubhendra's Avatar
shubhendra
Offline
Forum Nokia Champion
And one more thing i noticed today was in both of my emulators,
S60 2nd edition FP2- wins udeb and S60 2nd edition FP2 (debug) and i am not able to display arabic characters beyond "U+064A" as note.
Is there something wrong because i was looking at arabic unicode characters and they vary from U+0600 to U+06FF.

http://en.wikipedia.org/wiki/Arabic_Unicode


IDEAS is all they need but still they think only Genius can give them that.
Reply With Quote

#10 Old Re: Font & National Code - 2008-06-20, 15:31

Join Date: Feb 2008
Posts: 25
Location: Moscow Russia
Send a message via ICQ to Versoul Send a message via Skype™ to Versoul
Versoul
Offline
Registered User
if you wont write russian
Code:
def ru(dec):return dec.decode('utf-8')
and in script
Code:
print ru("привет")
So do in Russia
Reply With Quote

#11 Old Re: Font & National Code - 2008-06-20, 21:41

Join Date: Oct 2007
Posts: 3
OsaMa-88
Offline
Registered User
hey look my problem is solved

i used PED 2.19 application

then define my lang

def arb(x):return x.decode('utf-8')


arb('الصقر الذهبي')


its work my interface of program now in arabic

(^_^)
Reply With Quote
Reply « Previous Thread | Next Thread »
Display Modes
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules

You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump
Similar Threads
Thread Thread Starter Forum Replies Last Post
How to get the name of the used font chrishawaii Symbian User Interface 1 2007-06-22 07:55
Setting font in Series 60 hariprasadth Symbian User Interface 3 2005-11-10 13:13
Security code bug on 6230! dabII General Discussion 1 2005-05-17 18:21
New font 6600 hamishw General Symbian C++ 0 2005-04-10 11:59
Why is client code to CSocketEngine hanging at Access Point dialogue? nawkboy General Symbian C++ 0 2003-02-24 05:00

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia