views:

45

answers:

1

i took some files from linux hosting to my windows via ftp and when i check file encodings utf8 without bom

now i need to convert those files back to ascii and send my other linux server

i zipped files can i do something like

unzip if its text file and ut8 format than convert it to ascii

when i am unzipping files , i want to make conversion

thanks ?

+5  A: 

The program you're looking for is iconv; it will convert between encodings. Use it like this:

iconv -f utf-8 -t ascii < infile > outfile

However. ASCII is a subset of UTF-8. That is, a file that's written in ASCII is also correct UTF-8 --- no conversion is needed. The only reason for needing to convert the other way is if there are characters in your UTF-8 file that are outside the ASCII range. And if this is the case, you can't convert it to ASCII, because ASCII doesn't have those characters!

Are you sure you mean ASCII? Pure ASCII is rare these days. ISO-8859-15 (Western European) or CP1252 (Windows) are much more common.

David Given
You probably want to use `ascii//TRANSLIT` so that it transliterates unrepresentable characters, rather than just bugging out.
caf