Add cyrillic-support option for cyrillic codepage hack

This commit is contained in:
Mike Primm 2011-11-14 14:08:24 +08:00 committed by mikeprimm
parent ad1b17bb27
commit 8bfe1a2db9
5 changed files with 27 additions and 2 deletions

View file

@ -31,3 +31,24 @@ function getMinecraftTime(servertime) {
night: !day
};
}
function chat_encoder(message) {
if (dynmap.options.cyrillic) {
if(message.source === 'player') {
var utftext = "";
for (var n = 0; n < message.text.length; n++) {
var c = message.text.charCodeAt(n);
if (c >= 192) {
var c = message.text.charCodeAt(n);
utftext += String.fromCharCode(c+848);
}
else if (c == 184) { utftext += String.fromCharCode(1105); }
else {
utftext += String.fromCharCode(c);
}
}
return utftext
}
}
return message.text;
}