everything is possible 1

To convert the Chinese and Japanese to Unicodes of my own.

28.05.09 08:50 PM Comment(s) By Charu

 Hi,


       Many of them would have struggled how to convert those for the HTML usages.

Use these codes in .html file.


What made me to do this?

I was doing I18N for my team, where we have to give the strings to the concerned person and we have to do then necessary steps for that.  This process usually takes around 2 to 3 days, which made driving into nuts for one string taking 3 days to convert. OMG a waste of time, energy, mail etc.  So wrote a code for that.  Ha ha ha, Simple ain't it?

==============================================================================

<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Unicode convertor for html files</title>
<html>
        <form name="form" id="form">
                <textarea id="unicode" rows="10" name="unicode"></textarea><br>
                <input type="button" value="get the value" onmouseup="getUnicode();"><br>
                <input type="reset" value="reset"><br>
                <textarea id="output" name="output" rows="10"></textarea>
<script type="text/javascript">

        function getUnicode() {
   var tstr = document.getElementById('unicode').value;
   var bstr = '';
   for(var i=0; i<tstr.length; i++)
   {
        if(tstr.charCodeAt(i)>127)
        {
                bstr += '&#' + tstr.charCodeAt(i) + ';';
        }
        else{
                bstr += tstr.charAt(i);
        }
   }
   document.form.output.value = bstr;
}
</script>
</form>
</html>

======================================================================================


Charu

Charu