LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 10-18-2007, 02:30 AM   #1
maxmil
LQ Newbie
 
Registered: Feb 2006
Posts: 21

Rep: Reputation: 15
Script to determine file encoding


I am looking for a way to determine the encoding of a file.

I need to convert a directory tree of files from ISO-8859-1 to UTF-8. I can do this with iconv.

The problem is that in my directory tree there are both binary files and files that have already been converted to UTF-8. I don't want to touch these files. I need to be able to determine if a file is eligeable for conversion before calling iconv.

Thanks
 
Old 10-18-2007, 07:47 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
`file' does what you're looking for...

It will tell you a files encoding.



Cheers,
Tink
 
Old 09-13-2008, 02:18 AM   #3
Miseq
LQ Newbie
 
Registered: Sep 2008
Posts: 1

Rep: Reputation: 0
Quote:
Originally Posted by Tinkster View Post
`file' does what you're looking for...

It will tell you a files encoding.



Cheers,
Tink
Your answer just isn't correct. He asked for a tool which will does it automatically and you adwised him to do it himself by hand.

I've just tried to find such tool and I've found auto_ef or libauto_ef. This is tool from Sun Solaris and I'm still trying to find it's source code in OpenSolaris.
 
Old 09-13-2008, 03:26 AM   #4
Mr. C.
Senior Member
 
Registered: Jun 2008
Posts: 2,529

Rep: Reputation: 63
The missing term was codeset.

U don't know of any utilities, but here's a description of how to determine codeset:

http://codesnipers.com/?q=node/68

It doesn't seem too difficult to write a script to implement this.
 
  


Reply



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



Similar Threads
Thread Thread Starter Forum Replies Last Post
determine encoding type of a file (ie - UTF-8) chovy Linux - Software 1 04-03-2006 12:46 AM
s there a way to determine the owner of a file by using a script? DHoody Programming 4 01-27-2006 10:01 AM
how to determine script path cxc Programming 3 09-10-2005 08:36 AM
Script to determine last disconnection colabus Linux - Newbie 4 09-24-2004 12:42 AM
My script for encoding audio IRIGHTI LinuxQuestions.org Member Success Stories 1 06-18-2004 01:29 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 01:37 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration