[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

How can I determine the character encoding of a file?

Posted on 2008-11-18
2
Medium Priority
?
1,023 Views
Last Modified: 2012-05-05
Hi,
How can I determine the character encoding of a file?
i.e. BIG5, SHIFT_JIS, UTF-8, etc.
This is on linux or any other unix flavors

I know iconv converts from one encoding to another, but this doesn't help me.
I guess something similar to auto_ef in solaris 10.

Thanks
Jamie
0
Comment
Question by:jamie_lynn
2 Comments
 
LVL 85

Expert Comment

by:ozo
ID: 22991929
try to interpret in an encoding and check if makes sense.
0
 
LVL 53

Accepted Solution

by:
Infinity08 earned 2000 total points
ID: 22992825
From the auto_ef man page :

        "The auto_ef utility identifies the encoding of a given file. The utility judges the
        encoding by using the iconv code conversion, determining whether a certain
        code conversion was successful with the file, and also by performing frequency
        analyses on the character sequences that appear in the file."

So, it uses iconv internally.


Here's the source code for auto_ef :

        http://src.opensolaris.org/source/xref/nv-g11n/g11n/src/cmd/auto_ef/

You can try to get it to work on your system (if there isn't a version available for your system already).
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you thought about creating an iPhone application (app), but didn't even know where to get started? Here's how: ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Important pre-programming comments: I’ve never tri…
Preface I don't like visual development tools that are supposed to write a program for me. Even if it is Xcode and I can use Interface Builder. Yes, it is a perfect tool and has helped me a lot, mainly, in the beginning, when my programs were small…
The goal of this video is to provide viewers with basic examples to understand and use pointers in the C programming language.
The goal of this video is to provide viewers with basic examples to understand opening and writing to files in the C programming language.

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question