This Javascript function converts text coded in UTF8 into Kamenický encoding.
function kamenicky(t) {
var out = "";
var ch = "ČüéďäĎŤčěĚĹÍľĺÄÁÉžŽôöÓůÚýÖÜŠĽÝŘťáíóúňŇŮÔšřŕŔ¼§«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙•√ⁿ²■" + String.fromCharCode(160);
for (var n = 0; n < t.length; n++) {
var c = ch.indexOf(t[n])+128;
if (c < 256 && c > 127)
out += String.fromCharCode(c);
else
out += t[n];
}
return out;
}
Note: Char á has code 160. In Unicode it is Non-breaking space and by pasting char á will be lost.
12.4.2020, Andrej Priehradný Zaradené v: Programovanie; Prečítané: 164×