Search code examples
javaintellij-ideabuildartifact

Intellij build artifact - runnable jar UTF-8


I builded a project that reads a csv file (saved as csv UTF-8). in my project i read every line of that csv file. The output of every line is displayed in a log file.

Now when i run my project in intellij and i look into the log file all the lines are readable. But when i build an artifact from my project and then run that jar some symbols that are in the csv are replaced by a '?' symbol ..

i looked into the settings of my project under file encoding and there is everything UTF-8 also.

I have no clue how that is possible .. Can anyone help me out ? Thx !


Solution

  • Specify the encoding when running the app from the command line like this:

    java -Dfile.encoding=UTF-8 -jar yourapp.jar param1 param2
    

    Or change your app code that reads/writes files to explicitly force the correct encoding.