Platform encoding or JNU encoding in Jira is set to ANSI_X3.4-1968 even though the server is set to UTF-8
Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.
Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Symptoms
The following appears in the atlassian-jira.log while Jira startup and also in ⚙️ → System → System Info page:
sun.jnu.encoding = ANSI_X3.4-1968
This can also cause issues when trying to add attachments with filenames containing special characters (e.g. the German umlaut character). The following error is seen in atlassian-jira.log:
Got exception while saving attachment in attachment store. Exception: Malformed input or input contains unmappable characters
Diagnosis
Run the command locale in Jira server
to find the following result:
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=
Cause
The Platform or JNU encoding in Jira has been set to ANSI_X3.4-1968. This encoding can cause issues in Jira as the encoding supported in Jira is only UTF-8.
Solution
1. In the setenv.sh/bat file:
- Add the following JVM parameter by editing the line below before the export JVM_SUPPORT_RECOMMENDED_ARGS parameter:
JVM_SUPPORT_RECOMMENDED_ARGS="-Dfile.encoding=UTF-8 -Dsun.jnu.encoding=UTF-8"
- If using OpenJDK 11, then the following addition might also be required. Add the following line to setenv.sh/bat
export LC_ALL=en_US.UTF-8
If starting Jira as a Windows service, follow the instructions detailed in https://confluence.atlassian.com/adminjiraserver/setting-properties-and-options-on-startup-938847831.html
- Add the following line to set the LANG environment variable:
export LANG=en_US.UTF-8
2. Take the following additional steps if you use Redhat or Ubuntu:
- In Redhat 6.x (RPM-Based distributions), set the LANG and LC_ALL values in /etc/sysconfig/i18n as follows:
LANG="en_US.UTF-8"
LC_ALL="en_US.UTF-8"
- In Redhat 7.x (RPM-Based distributions), run the following command:
sudo localectl set-locale LANG="en_US.UTF-8"
- In Ubuntu (Debian and Debian-based distributions), set the LANG and LC_ALL values in /etc/default/locale as follows:
LANG="en_US.UTF-8"
LC_ALL="en_US.UTF-8"
You must use the default locale entry that is common to your language for the UTF-8 character set, the choice en_US.UTF-8 is the correct choice for US English language, while your language may vary
Related articles: