• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Save/Load system with foreign language

Status
Not open for further replies.
Level 9
Joined
Apr 26, 2011
Messages
403
what happen to save/load system if... player name do not use ASCII character ? (eg, player's name in foreign language character)

are there anyway to convert those character to raw integer ?
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
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.
 
Level 9
Joined
Apr 26, 2011
Messages
403
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.

so if I call :
JASS:
set names[i] = GetPlayerName(Player(i))

It doesn't what language they use, I will get their name in ASCII characters rather than unicode characters right?


I found this AsciiCharToInteger function, do it cover all ASCII characters yet ?

JASS:
[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
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
It doesn't what language they use, I will get their name in ASCII characters rather than unicode characters right?
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).

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.
 
Level 9
Joined
Apr 26, 2011
Messages
403
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.

do you mean game will crash if
- player name is in foreign language
- and the map have save/load system (it use player's name for encryption)


A true mapping would feature 256 characters (what the game engine allocates per character), the function you provide gives far less than that.

above function only have around 100 characters.

how should I do it if I want to support 256 characters:
- 95x Normal ASCII from keyboard
- 32x Control characters
- 128x Special characters (like picture below)
extend.gif
 
Level 9
Joined
Apr 26, 2011
Messages
403
Just default unrecognized characters to some value. A good one would be the value of the position the unknown character is in the string.

do you know a quick example/presudo code for how to default unrecognized characters to some value ?
can I use the AsciiCharToInteger above without crash? (it have 0 as default)



EDIT:
http://www.thehelper.net/forums/archive/index.php/t-116124.html
after read someone posting same question, look like it is impossible, unless I want to create a huge array that store all possible unicode characters for the language I want to support...Which is quite ridiculous.
 
Last edited:
Status
Not open for further replies.
Top