Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Question on conversion from UTF8 to Shift_JIS (or ISO-2022-JP)

Reply
Thread Tools

Question on conversion from UTF8 to Shift_JIS (or ISO-2022-JP)

 
 
wing328hk@gmail.com
Guest
Posts: n/a
 
      04-19-2006
Hi,

Sorry this is a cross-post in Perl.Unicode.

I've some questions about converting Japanese from UTF8 to Shift_JIS
(or finally ISO_2022_JP) under Unix as follows:

UTF8 ==> Shift_JIS ==> ISO-2022-JP

The first conversion from UTF8 to Shift_JIS is done using Text::Iconv.
The second conversion from Shift_JIS to ISO-2022-JP is done using
mathematic algorithm.

However, I found that some Japanese characters are corrupted during the
first conversion (UTF8 ==> Shift_JIS). For example, the Japanese
character (or symbol) ~ can be found in Shift_JIS but it was
converted to ? after the first conversion.

Does any one know a perfect (or better) way to convert from UTF8 to
Shift_JIS (or ISO-2022-JP)?

I know that ISO-2022-JP is a subset of Unicode but I couldn't find a
perfect way to convert from UTF8 to ISO-2022-JP and that's why others
suggest me to first convert from UTF8 to Shift_JIS and then from
Shift_JIS to ISO_2022_JP mathematically. Your comment is highly
aprpeciated.

Thanks,
Wing

 
Reply With Quote
 
 
 
 
Peter J. Holzer
Guest
Posts: n/a
 
      04-22-2006
http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:
> I've some questions about converting Japanese from UTF8 to Shift_JIS
> (or finally ISO_2022_JP) under Unix as follows:
>
> UTF8 ==> Shift_JIS ==> ISO-2022-JP
>
> The first conversion from UTF8 to Shift_JIS is done using Text::Iconv.
> The second conversion from Shift_JIS to ISO-2022-JP is done using
> mathematic algorithm.

[Some characters aren't converted correctly]

Have you tried Encode?

hp

--
_ | Peter J. Holzer | Man könnte sich [die Diskussion] auch
|_|_) | Sysadmin WSR/LUGA | sparen, wenn man sie sich einfach sparen
| | | (E-Mail Removed) | würde.
__/ | http://www.hjp.at/ | -- Ralph Angenendt in dang 2006-04-15
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
given char* utf8, how to read unicode line by line, and output utf8 gry C++ 2 03-13-2012 04:32 AM
Re: Conversion from UTF32 to UTF8 for review Maxim Yegorushkin C++ 14 06-12-2010 07:13 AM
Re: Conversion from UTF32 to UTF8 for review Howard Hinnant C++ 0 05-31-2010 09:56 PM
Shift_jis encoding issue? Kev Jackson Ruby 1 03-27-2006 09:49 AM
UTF8 to Unicode conversion Spamtrap Perl 6 07-31-2004 04:59 AM



Advertisments