Default Java file.encoding and default charset changed to UTF-8

When the IBM® Java™ Virtual Machine starts up, it selects a file.encoding value based on the PASE CCSID. Starting with IBM i 7.4, the PASE CCSID defaults to 1208 , which means that the default Java file.encoding is now UTF-8. Refer to : PASE CCSID and Locale changed to UTF-8 for more information on the PASE CCSID change.

The file.encoding value influences the default charset used by the JVM among other things. This impacts reading and writing data in files, the String(byte[] bytes) constructor, and more. For more information about how file.encoding affects Java applications, refer to : JAVA character encodings

Applications wanting to use the prior behavior can set the environment variable PASE_DEFAULT_UTF8 to N in their job before starting a Java application. Refer to : Default file.encoding values for which file.encoding and default charset is used in that case.

Additionally, Java applications can explicitly set their preferred file.encoding in numerous ways, including :
  • Using the -D option to the java shell command, for example : java -Dfile.encoding=ISO8859_1 myProgram
  • Using the PROP option of the RUNJVA command, for example : RUNJVA CLASS(myProgram) PROP(file.encoding ISO8859_1)
  • Set the property in the QIBM_RPG_JAVA_PROPERTIES environment variable. See : Controlling how the JAVA virtual machine is set up for more information.
  • Add the property to the See : file for more information.