I created an application that reads 2 text files (txt), in one there is Russian text and in the other Spanish text. (Both txt in UTF-8)
Then arm a single txt with both texts. The output of the / txt is also / are UTF-8.
If I run the program in NetBeans IDE 8.2, the output of the txt files is perfect. Run it the number of times it runs is perfect.
If the program is created in a Jar, at the time of performing the task the txt files come out with strange characters.
NetBeans - > perfect Compiled Jar - > rare characters.
To read the txt use BufferedReader and to write BufferedWriter (FileWriter). This way in NetBeans walks perfect, in the Jar rare characters.
I tried using the same reading and in BufferedWriter script - > OutputStreamWriter - > FileOutputStream StandardCharsets.UTF_8. This way in NetBeans it is perfect and in the Jar characters are DOUBLY rare.
Always the files come out in UTF-8. (Here I enclose part of the texts according to what was used)
File Writer en NetBeans IDE UTF-8:
# --- 0.13: Макс подходит к комнате Анны, дверь закрыта
13.ka.0@4@<i>Обычно мама в это время отдыхает. Скорее всего, она ещё не спит. Оставить её в покое или войти?</i>|<i>Por lo general, mamá se relaja a esta hora del día. ¿Debería ingresar o debería dejarla en paz?</i>
OutputStreamWriter -> FileOutputStream en NetBeans IDE UTF-8:
# --- 0.13: Макс подходит к комнате Анны, дверь закрыта
13.ka.0@4@<i>Обычно мама в это время отдыхает. Скорее всего, она ещё не спит. Оставить её в покое или войти?</i>|<i>Por lo general, mamá se relaja a esta hora del día. ¿Debería ingresar o debería dejarla en paz?</i>
File Writer en Jar UTF-8:
# --- 0.13: Мак�? подходит к комнате �?нны, дверь закрыта
13.ka.0@4@<i>Обычно мама в �?то врем�? отдыхает. Скорее в�?его, она ещё не �?пит. О�?тавить её в покое или войти?</i>|<i>Por lo general, mamá se relaja a esta hora del día. ¿Debería ingresar o debería dejarla en paz?</i>
OutputStreamWriter -> FileOutputStream en Jar UTF-8:
# --- 0.13: Мак� подходит к комнате �нны, дверь закрыта
13.ka.0@4@<i>Обычно мама в Ñ�то времÑ� отдыхает. Скорее вÑ�его, она ещё не Ñ�пит. ОÑ�тавить её в покое или войти?</i>|<i>Por lo general, mamá se relaja a esta hora del dÃa. ¿DeberÃa ingresar o deberÃa dejarla en paz?</i>
My problem is only using the Jar, any way to solve this? o Know what it can be? Thanks.