how to convert a string variable from gb2312 into utf8 ?
 
detail:
1. I want this PerlScript can execute in Solaris.
2. piconv.bat can convert encoding, but it's only for Windows.
3. I have tried some method, such as :
   method1: use Encode;
            $gb2312="北京";
            $utf8=encode("utf8",$gb2312);
            print "$utf8";
   method2: use Encode;
            $gb2312="北京";
            $utf8=encode_utf8($gb2312);
            print "$utf8";
   method3: use encoding 'utf8', STDIN => 'gb2312',STDOUT => 'utf8';
            $gb2312="北京";
            $utf8=$gb2312;
            print "$utf8";
   But all failed!
 
I want the best method as follow, but which Perl_internal_function can realize it?
     $gb2312="北京";
     $utf8 = some_function_can_convert_gb2utf8($gb2312);
     print "$utf8";
 
 

Reply via email to