Thanks a lot for the reply
Actually i want to make a Simple Word Processor which will use Arabic Unicode Characters. I know how to detect keycode and change text field. but i dont know how to use unicode characters
e,g
whenever i use unicode
U+062C
textBox.htmlText = "U+062C";
it simply shows U+062C but not an arabic character
You need the hexadecimal (or decimal) equivalent of your unicode representation..
For example the "U+062C" is a Hex value of a unicode char, and its Hex numeric character reference is equivalent to: ج (note the semicolon at the end)
Or you may use its decimal equivalen which is: ج (again attention: the semicolon at the end)
[Need to convert the Hex 062C to Decimal (is 1580)]
In conclusion: use the approprite prefix to denote Hex (&#x) or Dec (&#) value (the Hex is the default) , add your unicode value (without the "U+") and add also a semicolon (;) at the end.
Example:
Code:
U+062C => ج (Unicode Hex) (Note the semicolon at the end)
U+062C => ج (Unicode Dec) (Note the semicolon at the end)
Similar: The next represents a capital "A":
Code:
U+0041 => A (Unicode Hex) (Capital A)
U+0041 => A (Unicode Dec) (the same as ASCII 65)
//65 => 4*16+1 (41 Hex)
See this AS example:
Code:
//U+062C this is equivalent to Hex: ج // note the semicolon
var Char=""
//Char=String.fromCharCode(1580) // Unicode Dec: ج Unicode Hex: ج (U+062C)
Char=String.fromCharCode(0x062C) // (as Hex)
var Code="ج".charCodeAt(0)
textBox.htmlText =Code+" "+Char+" جج" // outputs: 1580 ج ج ج
Also maybe this is useful:
How to Convert from Hex to Dec (and vise-versa):
PHP Code:
// Convert from Dec to Hex
var Dec:Number=1580
var Hex:String=Dec.toString(16)
trace(Hex) // 062C (in Hex)
// Convert from Hex to Dec
Hex="062C"
Dec=parseInt(Hex,16)
trace(Dec) // 1580 (in Dec)
Cheers!
Kostas
Last edited by Kostas Zotos; 07-03-2008 at 10:56 PM.
Thanks a lot for your reply
I use your code snippet, but it doesnt working
Im sure i did something wrong
please see my attached file and guide me in this regard
Thanks again
Maybe the font you are using doesn't include these characters..
Try not embed the font or use a devise font and espacially one of the flash "internal" fonts eg: _sans, _serif or _typewriter.. (write the font names in the font list combo box dialog, exactly as shown here)
You will get no antialising with these fonts however..
Normally if use the syntax as describe in my previous post you will get the results you want (most probably..)