简体   繁体   中英

symbol λ doesn´t work in jar file but in eclipse run yes

I do not have any problem while I am in Eclipse, but when I run a the jar file, problems apperars.

This are the different exists that produce the program. Eclipse

   Clave: B := CB| b| S| 
   Clave: S := aBCd|  -> axioma
   Clave: C := cc| e| λ|  

Jar Exit from Jar file I can´t write because have special characters

The problem is that the jar file doesn´t write λ in the variable of the program, so when i want to use the program crash.

This is in a Spring Application.

Thanks

This is an encoding problem : eg λ encoded in UTF-8 will be shown as λ when using the ISO-8859-16 encoding.

Because strings are stored as UTF-8 in Java bytecode, the encoding error could occur either during compilation or when printing:

  • If you are not using Eclipse to create the JAR but eg Maven or Gradle, make sure to use the correct encoding for the source code in the compile task (see here for Maven and here for Gradle )
  • When output ting, make sure that where UFT-8 is printed, this is correctly decoded as UTF-8 . This depends on where λ is printed (eg on the Windows command prompt, on a Linux terminal or into an HTML file). In Eclipse the encoding for the Console view is set in the run configuration in the tab Common .

In this case the solution exactly was:

BufferedReader b = new BufferedReader(new InputStreamReader(isFile, StandardCharsets.UTF_8));

De ese mmodo obligas a que lea por defecto en UTF_8 y no dependas del resto de configuraciones

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM