#!/bin/bash ## NOTE: if iso8859-1 result is wanted, then add fixups for the Windows-only characters; ## going directly to iso8859-1 with iconv is disappointing and is not recommended. ## Eugene Reimer 2009-06 iconv -f utf8 -t cp1252 $1 >$2; touch -r$1 $2 exit 2009-06: the desired fixups for converting cp1252 to iso8859-1 can be done with iconv after all; the appropriate commandline is: iconv -c -f windows-1252 -t iso-8859-1//TRANSLIT the "//TRANSLIT" suffix tells iconv to substitute look-like chars for those lacking an exact counterpart, which is exactly the nonstandard conversion we want; the -c option tells iconv to omit invalid characters from output (without that it chokes on invalid chars instead of doing anything useful); NOTE: the man-page for iconv (for my version) mentions neither of these "options", nor does it mention the --help option; however, running iconv --help works and the output mentions the -c option, though not the quirky TRANSLIT "option"; that nonstandard option I encountered in: http://www.gnu.org/software/libiconv/ with these options, one could presumably use iconv to go directly from utf8 to iso8859-1, and it may even have such look-alike "translit" fixups for other than the troublesome Windows-only characters, although I haven't tried it; I lost interest in these fixups when I discovered how to get Linux to work with the cp1252 charset as explained in http://ereimer.net/programs/charsets-cp1252-utf8.htm; although I then went on to switch to utf8 as also explained in that same article;