Convert ANSI to UTF-8 using linux shell

Hi,

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

Regards,
alcaniAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

tty2Commented:
iconv -f ANSI_X3 -t UTF-8 filename

To display all encodings:

iconv -l
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
woolmilkporcCommented:
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
alcaniAuthor Commented:
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
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

woolmilkporcCommented:
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
woolmilkporcCommented:
... 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
tty2Commented:
Use command "file":

file filename.txt
filename.txt: UTF-8 Unicode text
0
alcaniAuthor Commented:
Thank you!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Shell Scripting

From novice to tech pro — start learning today.