Converting latin1 (iso-8859-1) to utf8 (the file content itself)

Markus Schönhaber ubuntu-users at
Fri Nov 17 14:04:59 UTC 2006

rodrigochinaski wrote:

> Now I need to tool to convert latin1 content of some text files
> (basically m3u playlists and checksum.md5 files) to utf8 inline. I
> couldn't do with iconv, it needs an output file and I wish it just
> worked as convmv, where the input file is the same output.

Why don't you roll your own? A shell script like

#! /bin/bash


for f in "$@"; do
    echo converting $f
    bf=`basename "$f"`
    iconv -f iso-8859-1 -t utf-8 "$f" > "${TEMPDIR}$bf"
    mv "${TEMPDIR}$bf" "$f"

should do the trick. But handle with care - no sanity checks performed.


More information about the ubuntu-users mailing list