Can't read UTF-8 filenames when launched as an Upstart service

后端 未结 2 1173
忘了有多久
忘了有多久 2021-02-04 06:39

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ò/         


        
2条回答
  •  情话喂你
    2021-02-04 07:35

    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
    

提交回复
热议问题