Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: CJK / shiftjis

by JavaFan (Canon)
on Dec 14, 2010 at 15:27 UTC ( [id://877103]=note: print w/replies, xml ) Need Help??


in reply to CJK / shiftjis

I've little experience with encodings, but if the file contains shiftjis encoding, opening it with the utf8 layer is wrong. First opening it with the utf8 layer, then with shiftjis is pointless, the first layer won't stick.

There's a syntax to open a file with multiple layers at once, but I don't remember the syntax off-hand. However, I don't think that will be correct for your problem. You write We need support for UTF8 and shiftjis. Do you mean your file contains both UTF8 and shiftjis data? I do not think any of the encoding layers is going to help you there - it's not smart enough to decide which bytes should be considered UTF-8, and which bytes shiftjis. You'll have to open it in binary mode, read in chunks all in the same encoding, and then do whatever you need to do.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://877103]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (4)
As of 2024-04-19 02:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found