===== Transliteration of non latin texts ===== If you would like to convert UTF-8 cyrillic to readable latin, you can dynamically transliterate the content of the %%
/* original javascript by Eugene Spearance (http://www.spearance.ru) */
function translit()
{
document.getElementById('dokuwiki').innerHTML=convert(document.getElementById('dokuwiki').innerHTML)
}
var rusChars = new Array('Щ','Ð','Ж','Ч','Ш','Ð','Ю','Я','Ð','Б','Ð’','Г','Д','Е','З','И','Й','К','Л','Ðœ','Ð','О','П','Ð ','С','Т','У','Ф','Ð¥','Ц','Ъ','Ы','Ь','щ','Ñ‘','ж','ч','ш','Ñ','ÑŽ','Ñ','а','б','в','г','д','е','з','и','й','к','л','м','н','о','п','Ñ€','Ñ','Ñ‚','у','Ñ„','Ñ…','ц','ÑŠ','Ñ‹','Ь');
var transChars = new
Array('SHH','JO','ZH','CH','SH','JE','JU','JA','A','B','V','G','D','E','Z','I','J','K','L','M','N','O','P','R','S','T','U','F','X','C','#','Y','‘','shh','jo','zh','ch','sh','je','ju','ja','a','b','v','g','d','e','z','i','j','k','l','m','n','o','p','r','s','t','u','f','x','c','#','y','‘');
function convert(from){
var to = new String();
var len = from.length;
var character, isRus;
for(i=0; i < len; i++){
character = from.charAt(i,1);
isRus = false;
for(j=0; j < rusChars.length; j++){
if(character == rusChars[j]){
isRus = true;
break;
}
}
to += (isRus) ? transChars[j] : character;
}
return(to);
}
----
* Change the %%
ptln('',$it);
----
Please note that this is client-side javascript, and that your browser might take some time/resources to process it. Of course server-side transliteration would be better...
If you would like to use this for transliteration of non cyrillic (other UTF-8 characters, it is easy to get the strings in UTF-8 by just putting them in a page, and then take a look at the raw file in the /data/pages/ directory.
Alternatively you may use an online UTF-8 encoder like this [[http://translit.us|online translit converter]].
====== Discussion ======
People that use this tip, could you please provide feedback? Thanks, Riny
----