Convert text into Kamenický encoding

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;
}
Testing page for converting into Kamenický

Note: Char á has code 160. In Unicode it is Non-breaking space and by pasting char á will be lost.

Link

Wikipedia: Kamenický encoding

12.4.2020, Andrej Priehradný Zaradené v: Programovanie; Prečítané: 24×

< Predošlý článok: Návrh výstuže do žb prierezu

Komentáre (0)

Generované 0,067s

Dilbert

© 2010-2020

Kontakt

Social

facebook

twitter