javadba has asked for the wisdom of the Perl Monks concerning the following question:
There are CJK errors when reading a text file - we do have Japanese content so this would be expected. We need support for UTF8 and shiftjis. Can I use a layered approach? Here is the code and the error
Current code:
open(INFD, '<:utf8', $inFile) or die "Cannot open $inFile: $!";
Current Error:
ERROR: invalid byte sequence for encoding "UTF8": 0xe0b8 HINT: This error can also happen if the byte sequence does not matc +h the encoding expected by the server, which is controlled by "client +_encoding".
One Perl site recommended layered approach:
open(INFD, '<:utf8', $inFile) or die "Cannot open $inFile: $!"; open(INFD, '<:shiftjis', $inFile) or die "Cannot open $inFile: $! +";
Is this the way to go? Other ideas?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: CJK / shiftjis
by JavaFan (Canon) on Dec 14, 2010 at 15:27 UTC | |
|
Re: CJK / shiftjis
by Anonyrnous Monk (Hermit) on Dec 14, 2010 at 15:57 UTC |