Adding new chars to the server (hard)
When the public chat packet unpacks the message from a byte to a String, it only uses certain chars:
Code:
public static char xlateTable[] = { ' ', 'e', 't', 'a', 'o', 'i', 'h', 'n',
's', 'r', 'd', 'l', 'u', 'm', 'w', 'c', 'y', 'f', 'g', 'p', 'b',
'v', 'k', 'x', 'j', 'q', 'z', '0', '1', '2', '3', '4', '5', '6',
'7', '8', '9', ' ', '!', '?', '.', ',', ':', ';', '(', ')', '-',
'&', '*', '\\', '\'', '@', '#', '+', '=', '\243', '$', '%', '"',
'[', ']' };
How would I make this method include the "/" char?
Code:
public static String textUnpack(byte packedData[], int size) {
int idx = 0, highNibble = -1;
for (int i = 0; i < size * 2; i++) {
int val = packedData[i / 2] >> (4 - 4 * (i % 2)) & 0xf;
if (highNibble == -1) {
if (val < 13)
decodeBuf[idx++] = xlateTable[val];
else
highNibble = val;
} else {
decodeBuf[idx++] = xlateTable[((highNibble << 4) + val) - 195];
highNibble = -1;
}
}
return new String(decodeBuf, 0, idx);
}
I have tried adding it to the array but It needs to be in a certain spot or something, can someone help me please?