Removing accents in source code

I very often find source code with accent, mainly comments in french. Some are UTF-8 and other ISO8859. Even if UTF-8 is now largely supported, using it in source code is looking for troubles. Here is a way to remove accents in a text file:

iconv -t ASCII//TRANSLIT myfile.c > myfile_without_accent.c

It will only work if you current locale support it.



A small script to convert UTF-8 to ASCII (to be used with find):

#! /bin/sh
export LANG=fr_FR.UTF-8
iconv -t ASCII//TRANSLIT $1 > $tmp
mv $tmp $1