I believe they are always forced to use some variation of ASCII just that not all language modes share the same value range for visible characters. Or atleast that would be logical considering the game data files only allocate 1 byte for text.player name do not use ASCII character
I believe they are always forced to use some variation of ASCII just that not all language modes share the same value range for visible characters. Or atleast that would be logical considering the game data files only allocate 1 byte for text.
You should be able to hard code most characters into the editor as a huge list. Hopefully the characters you do support map to characters in other languages making this not a problem.
Most people just default unsupported characters to some constant. An ugly solution but still completly viable.
set names[i] = GetPlayerName(Player(i))
[url]http://www.wc3jass.com/viewtopic.php?t=87[/url]
function AsciiCharToInteger takes string char returns integer
local string charMap = " !\"#$%%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"
local string u = SubString(char, 0, 1)
local string c
local integer i = 0
if u == "" or u == null then
return 0
elseif u == "\b" then // Backspace?
return 8
elseif u == "\t" then // Horizontal Tab?
return 9
elseif u == "\n" then // Newline
return 10
elseif u == "\f" then // Form feed?
return 12
elseif u == "\r" then // Carriage return
return 13
endif
loop
set c = SubString(charMap, i, i + 1)
exitwhen c == ""
if c == u then
return i + 32
endif
set i = i + 1
endloop
return 0
endfunction
Yes as the game opperates in ASCII like mapping. It is not true ASCII for foighen languages as they map it through a different font so what appears as valid text for them might be garbage to us (ASCII is a specific mapping to various meanings, WC3 violates this for other fonts where it gives different meanings to certain values).It doesn't what language they use, I will get their name in ASCII characters rather than unicode characters right?
No and it is impossible to do so using JASS because various control characters will cause the interpreter to crash when it validates the script.I found this AsciiCharToInteger function, do it cover all ASCII characters yet ?
No and it is impossible to do so using JASS because various control characters will cause the interpreter to crash when it validates the script.
A true mapping would feature 256 characters (what the game engine allocates per character), the function you provide gives far less than that.
Just default unrecognized characters to some value. A good one would be the value of the position the unknown character is in the string.