ÿþ <html> <head> A # M ! 2 @ / . 0 + > # M  8 G / B ( ?  K ! * 0 ? 5 0 M $ ? $ M 0 (22-09-2008) </title> <script type="text/javascript"> function convert_to_unicode() { var array_one = new Array( "d", "D", "[", "x", "X", "?", "p", "P", "N", "t", "T", ">", "Vª","V", "B", "M+", "Mª", "M", "<+", "<", ".", "r", "R", "F", "n", "/", "è", "u", "U", "iz", "i", "I", "Q", "¶", "c", "C", "H", "e", "E", ";" , '¸' , "j", 'z', "y", "Y", "o", "O", "\'", "\"", "l", "L", "g", "º", "J", "{", "=", "K", "}", "#", ":", ")", "Ù", "|", "G", "Ø", "ê", "vkS", "vks", "vk", "v", "bZ", "b", "m", "_", ",s", "," , "M k", "ks", "kS", 'kW', "k", "h", "q", "w", "`", "s", "S", "a", "¡", "%", '~', "A", "]", "(", "-", "\\", "^^", "^", "**", "*", "&", '¼', '½', "0", "1", "2", "3", "4", "5","6", "7", "8", "9" ) ; var array_two = new Array( " ", " M ", " M ", " ", " M ", " M ", " ", " M ", " ", " ", " M ", " ", " M 0 ", " ", " ", "\ ", "! M 0 ", "! ", "] ", "" ", "# M ", "$ ", "$ M ", "% M ", "& ", "' M ", "' M ", "( ", "( M ", "* M 0 ", "* ", "* M ", "+ ", "+ M ", ", ", ", M ", "- M ", ". ", ". M ", "/ ", "/ M ", "0 ", 'M 0 ', "2 ", "2 M ", "5 ", "5 M ", "6 M ", "7 M ", "8 ", "8 M ", "9 ", '9 M ', "6 M 0 ", " M 7 M ", "$ M 0 ", " M  ", "& M 5 ", "0 A ", "0 B ", "& M ' ", "$ M $ M ", "& M / ", "3 ", " M 0 ", " M  ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", "", "K ", "L ", 'I ', "> ", "@ ", "A ", "B ", "C ", "G ", "H ", " ", " ", ":", 'M ' , "d ", ",", ";", ".", "?", '\"', "\ ", '\"', "\ ", "-", '(', ')' , "f ", "g ", "h ", "i ", "j ", "k ", "l ", "m ", "n ", "o " ) ; var array_one_length = array_one.length ; if ( (document.getElementById("text_or_html")).selectedIndex == 0 ) // if the input is plain text { document.getElementById("unicode_text").value = "You have chosen SIMPLE TEXT in Agra font to convert into Unicode. Conversion in progress.." ; var modified_substring = document.getElementById("legacy_text").value ; Replace_Symbols( ) ; var processed_text = modified_substring ; processed_text = processed_text.replace( /Sanskrit 99/g , "mangal" ) ; document.getElementById("unicode_text").value = processed_text ; } else // if input is HTML then { document.getElementById("unicode_text").value = "You have chosen HTML TEXT in Agra font to convert into Unicode. Conversion in progress.." ; var remaining_text = document.getElementById("legacy_text").value ; var processed_text = "" ; //blank initially var position_of_current_opening_bracket = 0 ; var position_of_next_closing_bracket = 1 ; var idx = remaining_text.indexOf( "<p " ) // search starting from paragraphs. then search for sanskrit 99. idx = remaining_text.indexOf( "Sanskrit 99" , idx ) var idx2 = 0 // position_of_current_opening_bracket ">" var idx3 = 0 // position of "/span" var idx4 = 0 // postion of "span" only , ie span without "/" while ( idx != -1 ) // while-01 loop ; while "Sanskrit 99" is found.. { idx2 = remaining_text.indexOf( ">" , idx ) idx3 = remaining_text.indexOf( "/span" , idx2 ) idx4 = remaining_text.indexOf( "span" , idx2 ) while ( idx4 < idx3 ) // this loop to take care of nested span. { idx4 = remaining_text.indexOf( "span" , idx3+4 ) ; idx3 = remaining_text.indexOf( "/span" , idx3+4 ) ; } var modified_substring = remaining_text.substring( idx2 , idx3 ) ; modified_substring = modified_substring.replace( />/g , ">>" ) ; processed_text = processed_text + remaining_text.substring( 0 , idx2 ) + modified_substring + "/span" ; remaining_text = remaining_text.substring( idx3 + 5 ) ; //remaining_text excludes "/span" idx = remaining_text.indexOf( "Sanskrit 99" ) ; } //end of outermost while-01 processed_text = processed_text + remaining_text ; // ----------------------------- // This section for taking care of paragraphs marked class = MsoBodyText or class = MsoBodyText remaining_text = processed_text ; processed_text = "" ; //blank initially var position_of_start_of_paragraph = 0 ; var position_of_end_of_paragraph = 1 ; position_of_start_of_paragraph = remaining_text.indexOf("<p ") ; while ( position_of_start_of_paragraph != -1 ) //search for <p in the remaining_text { position_of_start_of_paragraph = remaining_text.indexOf("<p ") ; position_of_end_of_paragraph = remaining_text.indexOf("/p>") ; modified_substring = remaining_text.substring( position_of_start_of_paragraph + 3 , position_of_end_of_paragraph ) ; if ( modified_substring.indexOf( "MsoBodyText" ) != -1 ) { modified_substring = modified_substring.replace( />/g , ">>" ) ; // repace all ">" with ">>" in this paragraph idx = modified_substring.indexOf("font-family") ; // in Mybodytext, whereever font-family is found, it means it is roman text. idx2 = 0 ; // position of ">>" idx3 = 0 ; // position of "/span" idx4 = 0 ; // position of "span" only without "/" while ( idx != -1 ) // again change ">>" to ">" only those which occure immediately after font-family:"Times new Roman" { idx2 = modified_substring.indexOf( ">>" , idx ) ; idx3 = modified_substring.indexOf( "/span" , idx2 ) ; idx4 = modified_substring.indexOf( "span" , idx2 ) ; while ( idx4 < idx3 ) { idx4 = modified_substring.indexOf( "span" , idx3+4 ) ; idx3 = modified_substring.indexOf( "/span" , idx3+4 ) ; } modified_substring = modified_substring.substring( 0, idx2 ) + (modified_substring.substring( idx2 , idx3 )).replace( />>/g , ">" ) + modified_substring.substring( idx3 ) ; idx = modified_substring.indexOf( "font-family" , idx3 ) ; } // end of while inner loop } // end of if statement processed_text = processed_text + remaining_text.substring( 0 , position_of_start_of_paragraph + 3 ) + modified_substring + "/p>" ; remaining_text = remaining_text.substring( position_of_end_of_paragraph + 3 ) ; position_of_start_of_paragraph = remaining_text.indexOf("<p ") ; } // end of outer while loop processed_text = processed_text + remaining_text ; // ------------------------ // Now do actual font conversion of text occuring between all the pairs >> and < remaining_text = processed_text ; processed_text = "" ; idx2 = remaining_text.indexOf( ">>" ) ; while ( idx2 != -1 ) // while-01 loop (checks if ">>" is still present { position_of_current_opening_bracket = remaining_text.indexOf( ">>" , idx2 ) position_of_next_closing_bracket = remaining_text.indexOf( "<" , position_of_current_opening_bracket ) modified_substring = remaining_text.substring( position_of_current_opening_bracket + 2 , position_of_next_closing_bracket ) ; processed_text = processed_text + remaining_text.substring( 0 , position_of_current_opening_bracket + 1 ) ; // ">" included by using +1 here remaining_text = remaining_text.substring( position_of_next_closing_bracket + 1 ) ; //remaining_text excludes the closing bracket Replace_Symbols() ; // call the subroutine and replace the legacy symbols with corresponding Unicode. processed_text = processed_text + modified_substring + "<" ; idx2 = remaining_text.indexOf( ">>" ) ; } //end of outermost while-01 processed_text = processed_text + remaining_text ; // do follwing conversions which are still left or were done incorrectly due to unavoidable reasons. processed_text = processed_text.replace( /Agra/g , "mangal" ) ; processed_text = processed_text.replace( /-8  / /g , "" " ) ; processed_text = processed_text.replace( /-A ( 5  / /g , "7 M " ) ; processed_text = processed_text.replace( /-  / /g , "-" ) ; processed_text = processed_text.replace( /-9  / /g , " " ) ; processed_text = processed_text.replace( /-&  G  / /g , "/&nbsp" ) ; processed_text = processed_text.replace( /> E /g , "I " ) ; // now put the processed text in the output box finally. document.getElementById("unicode_text").value = processed_text } // end of else loop for HTML case // -------------------------------------------------- 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++ ) { 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 // code for replacing "f" with "? " (chhotee ee kii maatraa) and correcting its position too.(moving it one position forward) modified_substring = modified_substring.replace( /£/g , "0 M f" ) ; // at some places £ is used eg in "aarthik". var position_of_f = modified_substring.indexOf( "f" ) ; while ( position_of_f != -1 ) //while-02 { var charecter_next_to_f = modified_substring.charAt( position_of_f + 1 ) ; var charecter_to_be_replaced = "f" + charecter_next_to_f ; modified_substring = modified_substring.replace( charecter_to_be_replaced , charecter_next_to_f + "? " ) ; position_of_f = modified_substring.search( /f/ , position_of_f + 1 ) ; // search for f ahead of the current position. } // end of while-02 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 + 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 // Eliminating "Z" and putting 'half - r' at proper position for this. set_of_matras = "> ? @ A B C G H K L  :  E " var position_of_Z = modified_substring.indexOf( "Z" ) while ( position_of_Z > 0 ) // while-04 { probable_position_of_half_r = position_of_Z - 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_Z - probable_position_of_half_r ) ) ; new_replacement_string = "0 M " + charecter_to_be_replaced ; charecter_to_be_replaced = charecter_to_be_replaced + "Z" ; modified_substring = modified_substring.replace( charecter_to_be_replaced , new_replacement_string ) ; position_of_Z = modified_substring.indexOf( "Z" ) ; } // end of while-04 } // end of IF statement meant to supress processing of blank string. } // end of the function Replace_Symbols } // end of legacy_to_unicode function </script> </head> <!-- ---------------------------------------------------------------------------------- body of the HTML starts here. one text box is provided each for input and output. --> <body> <form name="form1"> Paste the text in Agra font in the box below : <br/><br/> <textarea name="TextToConvert" id="legacy_text" cols="80" rows="7"></textarea> <br><br> The input given in the above box is : <div > <select id="text_or_html"> <option>Plain TEXT</option> <option>HTML TEXT</option> </select> </div> <div align="middle"> <input type="button" id="converter" name="converter" value=" Convert to Unicode >> " onClick="convert_to_unicode();" accesskey="c" title="6 I 0 M    alt+c"> </div> <br><br> This is Unicode equivalent of the above : <br/><br> <textarea name="ConvertedText" id="unicode_text" cols="100" rows="13"></textarea> <br /><br /> </form> </body> </html>