[WJG] (26/09/09) Sometimes it really easy to do relatively complex jobs in Tcl. But, I guess regular Tclers know that anyway. Handling a lot of texts possibly in mixed romanised script is a daily task for me. SCIM on Linux goes a long way to help, but there's the need to constantly switch my input system between a number of encodings. Sometimes it helps to use ascii key combinations. This is where ITRANS [http://www.aczoom.com/itrans/] comes in useful. ITRANS a system developed as a means of depicting Indic languages using the base ASCII code set. So,its easy! Imagine my nightmares of using mixed Chinese-Characters, Pinyin, Romanised Sanskrit (IAST) [http://en.wikipedia.org/wiki/IAST] and English key mappings! Its a lot of switching about. Hence this little routine. I guess that an ITRANS to Devanagari mapper is now called for. ====== #=============== # ITrans-Unicode.tcl #=============== # Author: William J Giddings # Date: 26/09/09 #=============== #!/bin/sh # the next line restarts using tclsh \ exec tclsh "$0" "$@" #--------------- # convert ITRANS ascii sequence to Unicode #--------------- proc ITrans { key } { return [string map { "aa" "ā" "AA" "Ā" "ii" "ī" "II" "Ī" "uu" "ū" "UU" "Ū" ".r" "ṛ" ".R" "Ṛ" ".rr" "ṝ" ".RR" "Ṝ" ".l" "ḷ" ".L" "Ḷ" ".ll" "ḹ" ".LL" "Ḹ" ".M" "ṁ" ".m" "ṃ" ".h" "ḥ" ".H" "Ḥ" ";n" "ṅ" ";N" "Ṅ" "~n" "ñ" "~N" "Ñ" ".t" "ṭ" ".T" "Ṭ" ".d" "ḍ" ".D" "Ḍ" ".n" "ṇ" ".N" "Ṇ" ";s" "ś" ";S" "Ś" ".s" "ṣ" ".S" "Ṣ" } $key] } puts [ITrans "praaj~napaaramitaa"] puts [ITrans "rat.nagunasa.Mcayagaathaa"] puts [ITrans "K.r.s.na"] ====== <>Enter Category Here