- Home /
Looking for a javascript unity implementation of FromCharCode?
Has anyone implemented a FromCharCode replacement? (it's inverse charCodeAt? for my code I really need an int to be returned by charCodeAt)
I am trying to implement Huffman encoding to send a blob of data encoded as text up to a web site. (it is actually a bunch of XML that will get decoded and processed on the other end) (I am trying to leverage tyler akins javascript implementation of Huffman encoding http://rumkin.com/tools/compression/ and also Chris Veness's javascript implementation of TEA http://www.movable-type.co.uk/scripts/tea-block.html I can get them both working if I can figure out an implementation of FromCharCode (then I'll be able to post the resulting code).
the chunk of code I am trying to use fromCarCode is as follows
function BitsToBytes(i : String) {
var o : int = 42;
if (i[0] == '1') {
o += 32;
}
if (i[1] == '1') {
o += 16;
}
if (i[2] == '1') {
o += 8;
}
if (i[3] == '1') {
o += 4;
}
if (i[4] == '1') {
o += 2;
}
if (i[5] == '1') {
o += 1;
}
if (o >= 92) {
o ++;
}
String.fromCharCode(o);
}
The Mono class System.Text.Decode does not seem to work. Has anyone tried the Mono function: System.Char.ConvertFromUtf32?
Thank you.
Your answer
Follow this Question
Related Questions
Convert type `UnityEngine.Collider' to `string'? 1 Answer
Convert Array to String 3 Answers
How to convert a list of Resolution to String 2 Answers
particle system position on top of string position 0 Answers
Text UI is not being assigned 2 Answers