?
Solved

Convert ANSI to UTF-8 using linux shell

Posted on 2010-04-07
7
Medium Priority
?
8,391 Views
Last Modified: 2013-12-26
Hi,

I would like to convert a text file ANSI encoding to UTF-8 using a shell under Linux. Is it possible?

Regards,
0
Comment
Question by:alcani
  • 3
  • 2
  • 2
7 Comments
 
LVL 6

Accepted Solution

by:
tty2 earned 1600 total points
ID: 30035600
iconv -f ANSI_X3 -t UTF-8 filename

To display all encodings:

iconv -l
0
 
LVL 68

Assisted Solution

by:woolmilkporc
woolmilkporc earned 400 total points
ID: 30035608
Hi,

check the iconv utility.

Use iconv -l to see available encoding formats.

The basic syntax is

iconv -f from_encoding -t to_encoding inputfile

The result is written to stdout or to a file specified using "-o outputfile"

See man iconv for more.

wmp


0
 

Author Comment

by:alcani
ID: 30039544
Ok, thank you for your comments,

Once the file is converted, there is any web page o service for validate that the file is in UTF-8?
0
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 68

Expert Comment

by:woolmilkporc
ID: 30042534
That's not an easy task.

Solaris has auto_ef, but Linux doesn't.

Some Linux' have enca. Try man enca - perhaps you're lucky.

Particularly for Unicode please check this: http://codesnipers.com/?q=node/68

wmp


0
 
LVL 68

Expert Comment

by:woolmilkporc
ID: 30042781
... you could also open the file with your browser, then click "View" -> "Encoding" (or the like, depends on the browser used).
The current encoding should be marked.
0
 
LVL 6

Assisted Solution

by:tty2
tty2 earned 1600 total points
ID: 30045139
Use command "file":

file filename.txt
filename.txt: UTF-8 Unicode text
0
 

Author Closing Comment

by:alcani
ID: 31711904
Thank you!
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

This Windows batch file is useful for organizing image files from a digital camera or other source, but can have many other uses.  It simply renames the file(s) to match their create date.  For example, if you took a picture today at 1:40pm and the …
Have you ever been frustrated by having to click seven times in order to retrieve a small bit of information from the web, always the same seven clicks, scrolling down and down until you reach your target? When you know the benefits of the command l…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
Suggested Courses

593 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