My Java program reads the contents of a directory recursively. This is a sample tree (note the non-ASCII characters):
./sviluppo
./sviluppo/ciaò
./sviluppo/ciaò/
Adding this to /etc/init.d/script fixed this issue for me (I copied it from /etc/init.d/tomcat7):
# Make sure script is started with system locale
if [ -r /etc/default/locale ]; then
. /etc/default/locale
export LANG
fi
Contents of /etc/default/locale on my machine:
LANGUAGE=en_US:en
LANG=en_US.UTF-8