LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   finding the encoding of a file (https://www.linuxquestions.org/questions/linux-newbie-8/finding-the-encoding-of-a-file-596163/)

mike_stlouis 10-31-2007 04:03 PM

finding the encoding of a file
 
if i have a file and i'm not sure exactly how it's encoded, how can i find out? the file i was working with was an actuate reporting file with a .bas extionsion and ended up bein utf-16, but i was just wondering for future reference if there's some view option or command i can run to tell me exactly how a file is encoded.
thanks in advance!
mike.

acid_kewpie 10-31-2007 04:32 PM

check the file command... http://unixhelp.ed.ac.uk/CGI/man-cgi?file may be useful to you.

dansmith127 11-01-2007 08:47 AM

Not possible
 
As far as I can tell there is no way to tell the encoding.

file yourfilename

can tell you whether it's ASCII text or not, but not the encoding. Essentially the encoding is context-dependent and nothing in the file as such defines it.

This thread: http://discuss.fogcreek.com/joelonso...w&ixPost=82874 goes through some of the issues and misunderstandings regarding character encoding.

file -i filename

will give you the MIME type, which can be useful, but it's not what you're seeking. It can't tell you the character encoding.


All times are GMT -5. The time now is 05:17 AM.