Platform encoding or JNU encoding in Jira Server or Data Center is set to ANSI_X3.4-1968 even though the server is set to UTF-8
Platform Notice: Data Center - This article applies to Atlassian products on the Data Center platform.
Note that this knowledge base article was created for the Data Center version of the product. Data Center knowledge base articles for non-Data Center-specific features may also work for Server versions of the product, however they have not been tested. 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 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
- 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
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"
- In Oracle Linux 8.x, run the following command:
sudo localectl set-locale en_US.UTF-8
3. Restart Jira
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
Alternative Solution
1. If the problem persists after the above steps, consider adding the locale variables directly at the top of the setenv.sh/bat file:
export LANG="en_US.UTF-8"
export LC_ALL="en_US.UTF-8"
2. Restart Jira