Bay Cao và Bay Xa – Fly High and Fly Far

August 7, 2008

Converting to sjis to utf-8

Filed under: Perl, Programming — Tags: , — doqkhanh @ 6:38 AM

This code can convert a Japanese Shift JIS string to a utf-8 string. Thank 中島さん (Mr Nakajima) for this useful code snippet.

use Unicode::Japanese;

my $keyword="";
$keyword = "something in Japanese like これわ日本語です。";

# use utf-8
my $converter = Unicode::Japanese->new($keyword, 'sjis');
$keyword = $converter->get;

#Su dung $keyword bt

Blog at WordPress.com.