Just starting out? Need help? Post your questions and find answers here.
loadstone
User
Posts: 97 Joined: Wed Jan 16, 2008 11:28 am
Location: china
Post
by loadstone » Sun Jun 29, 2008 5:22 am
When I change the sourcefile encoding to utf8 and checked the
"create unicode executable",then <ASC"你"> code can not get the value.
ps: if ansi mode,that can get the value.
"你" is a chinese word.
in VB chinese edition can do this Asc("你")=-15133,meybe VB inside immediately use the uncode?
thank
blueznl
PureBasic Expert
Posts: 6166 Joined: Sat May 17, 2003 11:31 am
Contact:
Post
by blueznl » Sun Jun 29, 2008 8:03 am
Asc() returns the Ascii value, Unicode characters do not necessarily have an Ascii value, so I fear you cannot rely on Asc() here...
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide
right here ... )
Marco2007
Enthusiast
Posts: 648 Joined: Tue Jun 12, 2007 10:30 am
Location: not there...
Post
by Marco2007 » Sun Jun 29, 2008 9:09 am
It works for me....
Code: Select all
number=Asc("你")
Debug number
If OpenWindow(0,0,0,300, 400,"") And CreateGadgetList(WindowID(0))
StringGadget(0, 20,20, 200, 30, Chr(number)+ " 你 " + Chr(20320))
SetGadgetFont(0, LoadFont(0, "Arial Unicode MS", 12))
EndIf
Repeat:Until WaitWindowEvent()=#WM_CLOSE
I get 20320 and it looks okay.
Unicode on and Utf-8 enabled.
PureBasic for Windows
loadstone
User
Posts: 97 Joined: Wed Jan 16, 2008 11:28 am
Location: china
Post
by loadstone » Sun Jun 29, 2008 10:50 am
oh,I understand
it work good!!!!
Rook Zimbabwe
Addict
Posts: 4322 Joined: Tue Jan 02, 2007 8:16 pm
Location: Cypress TX
Contact:
Post
by Rook Zimbabwe » Sun Jun 29, 2008 3:25 pm
Isn't there some function to return the unicode value? If not we may need a UNI(ñ) feature!
Marco2007
Enthusiast
Posts: 648 Joined: Tue Jun 12, 2007 10:30 am
Location: not there...
Post
by Marco2007 » Sun Jun 29, 2008 3:37 pm
Well, I don`t have problems with e.g. Asc("‱") + Unicode.
I`ve tried several Unicodes without any problems.
Try it...
For displaying, the right font has to be installed:
http://en.wikipedia.org/wiki/Unicode_typefaces
PureBasic for Windows
Fred
Administrator
Posts: 18162 Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:
Post
by Fred » Sun Jun 29, 2008 6:34 pm
Rook Zimbabwe wrote: Isn't there some function to return the unicode value? If not we may need a UNI(ñ) feature!
Asc() is here for that, where is the problem ?
blueznl
PureBasic Expert
Posts: 6166 Joined: Sat May 17, 2003 11:31 am
Contact:
Post
by blueznl » Sun Jun 29, 2008 11:03 pm
Fred, does it support all unicode formats / codes? If so a little note in the docs would make sense
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide
right here ... )
Fred
Administrator
Posts: 18162 Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:
Post
by Fred » Mon Jun 30, 2008 11:26 am
Sure it does, it returns a character, it's not ascii only. I will update the doc.