<html> <head> <B><Font color = darkblue><CENTER> Gita1 <=> / B ( ?  K ! + < K # M  * 0 ? 5 0 M $ ? $ M 0 (16-09-2009 21:25) </font></B></title><br> <Font color = blue>Last update: 16-09-2009 23:50</font> <script type="text/javascript"> function convert_to_unicode() { var array_one = new Array( "","+","#","$", "Z=","F=","N","X","8","","","T=","3","6","","o","O", "k>:",">","M", "k]:","k:0","ku:","kU:","k&:","ke:", "k:","k","K","g","G","V", "c","%","j","z", "!","@","#","$","[", "t","q","d","Q","n", "p","f:","f","b","B","m", "y","r","D","l","v","x","{","s","h", "a=E","a=e","a=C","a=","a","w*","w","W","~","Ae","A", "=E","=e","=","<","M > ","I","u","U","&","e","E","]\\","]","/","C", "","","","","","","","","","", "M K ","M L "," G "," B "," B ") var array_two = new Array( "P ","d ","\ ","] ", " M 7 ","$ M 0 "," M  ","6 M 0 ","& M 5 ","9 M . ","9 C ","$ M $ ","& M ' ","& M / ","( M ( ","0 A ","0 B ", " M 0 ","M 0 ","M 0 ", "  "," @ "," A "," B "," C "," G ", " "," M "," M "," M "," M "," ", " M "," "," M "," M ", " "," ","! ","" ","# M ", "$ M ","% M ","& ","' M ","( M ", "* M ","+ ","+ M ",", M ","- M ",". M ", "/ M ","0 ","2 M ","2 ","5 M ","6 M ","7 M ","8 M ","9 ", " "," "," "," "," "," "," "," "," "," "," ", "L ","K ","> ","M ","","@ ","A ","B ","C ","G ","H "," "," "," ","= ", "f ","g ","h ","i ","j ","k ","l ","m ","n ","o ", "G ","H ", "G  ","B  ","B  ") //************************************************************************************** // The following two characters are to be replaced through proper checking of locations: //************************************************************************************** // "i", // "? ", // // "*", // "0 M " (reph) //************************************************************************************** var array_one_length = array_one.length ; var modified_substring = document.getElementById("legacy_text").value ; Replace_Symbols( ) ; processed_text = modified_substring ; document.getElementById("unicode_text").value = processed_text ; // -------------------------------------------------- function Replace_Symbols( ) { //substitute array_two elements in place of corresponding array_one elements if ( modified_substring != "" ) // if stringto be converted is non-blank then no need of any processing. { for ( input_symbol_idx = 0; input_symbol_idx < array_one_length; input_symbol_idx++ ) { // alert(" modified substring = "+modified_substring) //*********************************************************** // if (input_symbol_idx==106) // { alert(" input_symbol_idx = "+input_symbol_idx); // alert(" input_symbol_idx = "+input_symbol_idx) //; alert(" character =" + modified_substring.CharCodeAt(input_symbol_idx)) // alert(" character = "+modified_string.fromCharCode(input_symbol_idx)) // } // if (input_symbol_idx == 107) // { alert(" input_symbol_idx = "+input_symbol_idx); // alert(" character = ",+string.fromCharCode(input_symbol_idx)) // } //*********************************************************** idx = 0 ; // index of the symbol being searched for replacement while (idx != -1 ) //while-00 { modified_substring = modified_substring.replace( array_one[ input_symbol_idx ] , array_two[input_symbol_idx] ) idx = modified_substring.indexOf( array_one[input_symbol_idx] ) } // end of while-00 loop // alert(" end of while loop") } // end of for loop // alert(" end of for loop") // alert(" modified substring2 = "+modified_substring) //******************************************************* var position_of_i = modified_substring.indexOf( "i" ) while ( position_of_i != -1 ) //while-02 { var charecter_next_to_i = modified_substring.charAt( position_of_i + 1 ) var charecter_to_be_replaced = "i" + charecter_next_to_i modified_substring = modified_substring.replace( charecter_to_be_replaced , charecter_next_to_i + "? " ) position_of_i = modified_substring.search( /i/ , position_of_i + 1 ) // search for i ahead of the current position. } // end of while-02 loop //********************************************************************************** // End of Code for Replacing four Special glyphs //********************************************************************************** // following loop to eliminate 'chhotee ee kee maatraa' on half-letters as a result of above transformation. var position_of_wrong_ee = modified_substring.indexOf( "? M " ) while ( position_of_wrong_ee != -1 ) //while-03 { var consonent_next_to_wrong_ee = modified_substring.charAt( position_of_wrong_ee + 2 ) var charecter_to_be_replaced = "? M " + consonent_next_to_wrong_ee modified_substring = modified_substring.replace( charecter_to_be_replaced , "M " + consonent_next_to_wrong_ee + "? " ) position_of_wrong_ee = modified_substring.search( /? M / , position_of_wrong_ee + 2 ) // search for 'wrong ee' ahead of the current position. } // end of while-03 loop // following loop to eliminate 'chhotee ee kee maatraa' on half-letters as a result of above transformation. var position_of_wrong_ee = modified_substring.indexOf( "?  M " ) while ( position_of_wrong_ee != -1 ) //while-03 { var consonent_next_to_wrong_ee = modified_substring.charAt( position_of_wrong_ee + 3 ) var charecter_to_be_replaced = "?  M " + consonent_next_to_wrong_ee modified_substring = modified_substring.replace( charecter_to_be_replaced , "M " + consonent_next_to_wrong_ee + "?  " ) position_of_wrong_ee = modified_substring.search( /?  M / , position_of_wrong_ee + 3 ) // search for 'wrong ee' ahead of the current position. } // end of while-03 loop // Eliminating reph "" and putting 'half - r' at proper position for this. set_of_matras = "> ? @ A B C G H K L  :  E " var position_of_R = modified_substring.indexOf( "*" ) while ( position_of_R > 0 ) // while-04 { probable_position_of_half_r = position_of_R - 1 ; var charecter_at_probable_position_of_half_r = modified_substring.charAt( probable_position_of_half_r ) // trying to find non-maatra position left to current O (ie, half -r). while ( set_of_matras.match( charecter_at_probable_position_of_half_r ) != null ) // while-05 { probable_position_of_half_r = probable_position_of_half_r - 1 ; charecter_at_probable_position_of_half_r = modified_substring.charAt( probable_position_of_half_r ) ; } // end of while-05 charecter_to_be_replaced = modified_substring.substr ( probable_position_of_half_r , ( position_of_R - probable_position_of_half_r ) ) ; new_replacement_string = "0 M " + charecter_to_be_replaced ; charecter_to_be_replaced = charecter_to_be_replaced + "*" ; modified_substring = modified_substring.replace( charecter_to_be_replaced , new_replacement_string ) ; position_of_R = modified_substring.indexOf( "*" ) ; } // end of while-04 } // end of IF statement meant to supress processing of blank string. } // end of the function Replace_Symbols } // end of convert_to_unicode function //******************************************************************************* function convert_to_Gita1() { var array_one = new Array( " < "," < "," < "," < ","! < ","" < ","+ < ", // two-byte varnas "!",".","d ",";","(",")","{","}","[","]","/","<","=",">",",","+","*","%", "Y M ","Y ","^ M ","^ ", //"X ? ","Y ? ","Z ? ","[ ? ","\ ? ","] ? ","^ ? ", "P ", "?", // " "," "," ", " M  ","9 M / ","9 C "," M  ","$ M $ M "," M $ ","6 M 0 ","& M / ","& M 5 ","& M & ","& M ' "," M 7 M "," M 7 "," M ","$ M 0 ","9 M 0 "," ? ", " M 0 A "," M 0 B ","M 0 A ","M 0 B ","0 B ","0 A ", " M 0 "," C ","+ M 0 ","+ C ", //"( M ( ", "\ ","] ", " M 0 ","! M 0 ","" M 0 ","M 0 ", "X ","Z ","[ M ", " M "," "," M "," "," M "," "," M "," "," ", " M "," "," ","[ "," M "," "," M "," "," M "," ", " "," ","! ","" ","# M ","# ", "$ M ","$ ","% M ","% ","& ","' M ","' ","( M ","( ", "* M ","* ","+ M ","+ ",", M ",", ","- M ","- ",". M ",". ", "/ M ","/ ","0 ","2 M ","2 ","3 ","5 M ","5 ","6 M ","6 ","7 M ","7 ","8 M ","8 ","9 M ","9 ", // "6 M ","6 M ", " "," "," "," "," "," "," "," "," "," "," "," "," "," ", "L ","K ","I ","> ","@ ","A ","B ","C ","G ","H "," "," ",":"," ","M ","E ","= ","< ") var array_two = new Array( "X ","Y ","Z ","[ ","\ ","] ","^ ", //one-byte varnas "","",".","","","","","","","","","","","",""," ","","0 ", "K,","","F,","", //"ik","iK","iga","ija","iD","iZ","iPa", "!","", // "? ","? ","? ", "&","(",")","+","<",">","Ea","V","W","_","w","x","xa","{","~","S","x", "u","u","`u","`U","$","", "","","","", // "", "D,","Z,", "T/","D/","Z/","`", "k,","ga,","j,", "@","k","#","K","g","ga","G","Ga","=", "c","ca","C","ja,","j","ja","J","Ja","H","Ha", "T","z","D","Z","N","Na", "%","t","q","qa","d","Q","Qa","n","na", "P","p","F","f","b","ba","B","Ba","m","ma", "y","ya","r","l","la","L","v","va","S","Sa","Y","Ya","s","sa","*","h", // "X","", "AaO","Aao","Aa^","Aa","A","a","[-","[","]","}","?",";","eo", "e", "aO","ao","a^","a","I","u","U","R","o","O","","M","",":","\\","^","|",",") //************************************************************ //Put "Enter chunk size:" line before "<textarea name= ..." if required to be used. //************************************************************ //Enter chunk size: <input type="text" name="chunksize" value="6000" size="7" maxsize="7" style="text-align:right"><br/><br/> //************************************************************ // The following two characters are to be replaced through proper checking of locations: // "0 M " (reph) // "Z" ) // "? " // "f" ) var array_one_length = array_one.length ; var modified_substring = document.getElementById("unicode_text").value ; Replace_Symbols( ) ; processed_text = modified_substring ; document.getElementById("legacy_text").value = processed_text ; //************************************************** function Replace_Symbols( ) { // if string to be converted is non-blank then no need of any processing. if (modified_substring != "" ) { // first replace the two-byte nukta_varNa with corresponding one-byte nukta varNas. // modified_substring = modified_substring.replace ( / < / , "X " ) ; // modified_substring = modified_substring.replace ( / < /g , "Y " ) ; // modified_substring = modified_substring.replace ( / < /g , "Z " ) ; // modified_substring = modified_substring.replace ( / < /g , "[ " ) ; // modified_substring = modified_substring.replace ( /! < /g , "\ " ) ; // modified_substring = modified_substring.replace ( /" < /g , "] " ) ; // modified_substring = modified_substring.replace ( /( < /g , ") " ) ; // modified_substring = modified_substring.replace ( /+ < /g , "^ " ) ; // modified_substring = modified_substring.replace ( // < /g , "_ " ) ; // modified_substring = modified_substring.replace ( /0 < /g , "1 " ) ; // code for replacing "? " (chhotee ee kii maatraa) with "i" and correcting its position too. var position_of_f = modified_substring.indexOf( "? " ) ; while ( position_of_f != -1 ) //while-02 { var character_left_to_f = modified_substring.charAt( position_of_f - 1 ) ; modified_substring = modified_substring.replace( character_left_to_f + "? " , "i" + character_left_to_f ) ; position_of_f = position_of_f - 1 ; while (( modified_substring.charAt( position_of_f - 1 ) == "M " ) & ( position_of_f != 0 ) ) { var string_to_be_replaced = modified_substring.charAt( position_of_f - 2 ) + "M " ; modified_substring = modified_substring.replace( string_to_be_replaced + "i", "i" + string_to_be_replaced ) ; position_of_f = position_of_f - 2 ; } position_of_f = modified_substring.search( /? / , position_of_f + 1 ) ; // search for f ahead of the current position. } // end of while-02 loop //************************************************************ // modified_substring = modified_substring.replace( /f0 M /g , "" ) ; //************************************************************ // Eliminating "0 M " and putting Z at proper position for this. set_of_matras = "> ? @ A B C G H K L  : E " modified_substring += ' ' ; // add two spaces after the string to avoid UNDEFINED char in the following code. modified_substring = modified_substring.replace ( /-/g , "" ) ; modified_substring = modified_substring.replace ( /6 M 0 M /g , "E" ) ; var space = " " var position_of_half_R = modified_substring.indexOf( "0 M " ) ; //************************************************************************************ while ( position_of_half_R > 0 ) // while-03 { // "0 M " is two bytes long var probable_position_of_Z = position_of_half_R + 2 ; var character_at_probable_position_of_Z = modified_substring.charAt( probable_position_of_Z ) // alert(" 3. probable_position_of_Z = "+probable_position_of_Z ); // alert(" 4. character_at_probable_position_of_Z = "+character_at_probable_position_of_Z ); // trying to find non-maatra position right to probable_position_of_Z . while( set_of_matras.match( character_at_probable_position_of_Z ) != null ) // while-04 { probable_position_of_Z = probable_position_of_Z + 1 ; character_at_probable_position_of_Z = modified_substring.charAt( probable_position_of_Z ) ; // alert(" 5. probable_position_of_Z = "+probable_position_of_Z ); // alert(" 6. character_at_probable_position_of_Z = "+character_at_probable_position_of_Z ); } // end of while-04 //************************************************************ // check if the next character is a halant //************************************************************ var right_to_position_of_Z = probable_position_of_Z + 1 ; // alert(" 7. right_to_position_of_Z = "+right_to_position_of_Z ); if (right_to_position_of_Z > 0) // if-03 { var character_right_to_position_of_Z = modified_substring.charAt( right_to_position_of_Z ) // alert(" 8. character_right_to_position_of_Z = "+character_right_to_position_of_Z ); while ("M ".match( character_right_to_position_of_Z ) != null ) // while-05 { // halant found, move to next character probable_position_of_Z = right_to_position_of_Z + 1 ; character_at_probable_position_of_Z = modified_substring.charAt( probable_position_of_Z ) ; // alert(" 9. probable_position_of_Z = "+probable_position_of_Z ); // alert("10. character_at_probable_position_of_Z = "+character_at_probable_position_of_Z ); right_to_position_of_Z = probable_position_of_Z + 1 ; character_right_to_position_of_Z = modified_substring.charAt( right_to_position_of_Z ) // alert("11. right_to_position_of_Z = "+right_to_position_of_Z ); // alert("12. character_right_to_position_of_Z = "+character_right_to_position_of_Z ); } // end of while-05 } // end of if-03 //************************************************************ string_to_be_replaced = modified_substring.substr ( position_of_half_R + 2,(probable_position_of_Z - position_of_half_R)-1) ; //************************************************************ // check if character_right_to_position_of_Z is a space // if (space.match(character_right_to_position_of_Z) != null) // { // string_to_be_replaced = string_to_be_replaced.substr(0,string_to_be_replaced.length - 1) // alert("13. string_to_be_replaced = "+string_to_be_replaced ); // alert("14. string_to_be_replaced.length ="+string_to_be_replaced.length); // } modified_substring = modified_substring.replace( "0 M " + string_to_be_replaced, string_to_be_replaced + "-" ) ; // alert("15. string_to_be_replaced = "+string_to_be_replaced ); // alert("16. modified_substring = "+modified_substring ); position_of_half_R = modified_substring.indexOf( "0 M " ) ; // alert("17. position_of_half_R = "+position_of_half_R ) } // end of while-03 //*********************************************************** modified_substring = modified_substring.substr ( 0 , modified_substring.length - 2 ) ; //substitute array_two elements in place of corresponding array_one elements for( input_symbol_idx = 0; input_symbol_idx < array_one_length; input_symbol_idx++ ) { idx = 0 ; // index of the symbol being searched for replacement while (idx != -1 ) //whie-00 { modified_substring = modified_substring.replace( array_one[ input_symbol_idx ] , array_two[input_symbol_idx] ) idx = modified_substring.indexOf( array_one[input_symbol_idx] ) } // end of while-00 loop } // end of for loop } // end of IF statement meant to supress processing of blank string. modified_substring = modified_substring.replace ( /-ao/g , "ao-" ) modified_substring = modified_substring.replace ( /-a/g , "a-" ) modified_substring = modified_substring.replace ( /-I/g , "I-" ) modified_substring = modified_substring.replace ( /\ -/g , "\-" ) modified_substring = modified_substring.replace ( /ki,/g , "ik," ) modified_substring = modified_substring.replace ( /Ki,/g , "i" ) modified_substring = modified_substring.replace ( /gai,/g , "iga," ) modified_substring = modified_substring.replace ( /fi,/g , "i" ) modified_substring = modified_substring.replace ( /Di,/g , "iD," ) modified_substring = modified_substring.replace ( /Zi,/g , "iZ," ) modified_substring = modified_substring.replace ( /jai,/g , "ija," ) modified_substring = modified_substring.replace ( /nai,/g , "ina," ) modified_substring = modified_substring.replace ( /ri,/g , "ir," ) modified_substring = modified_substring.replace ( /Li,/g , "iL," ) } // end of the function Replace_Symbols( ) } // end of convert_to_Gita1 function </script> </head> <!-- ---------------------------------------------------------------------------------- body of the HTML starts here. one text box is provided each for input and output. --> <body> <form name="form1"> <b>Gita1 font text-box </b><br/> <HTML><BODY bgColor='yellow'><CENTER> <textarea name="TextToConvert" id="legacy_text" cols="92" rows="6"></textarea> <br> <div align="middle"> <CENTER><input type="button" name="converter" id="converter" value=" Convert to Unicode >> " onClick="convert_to_unicode();" accesskey="c" title="6 I 0 M    alt+c"> </div> <br> <b><CENTER>Unicode text-box</b> <br/> <textarea name="ConvertedText" id="unicode_text" cols="92" rows="6"></textarea> <br /> <div align="middle"> <input type="button" id="converter" name="converter" value=" Convert to Gita1 >> " onClick="convert_to_Gita1();" accesskey="c" </div> </form> </body> </html>