Databases 4 min read

Fix Chinese Garbled Text in Oracle SQL*Plus on Windows and Linux

This guide explains why Chinese characters appear garbled in PL/SQL and SQL*Plus on Windows and Linux, shows how to verify the Oracle server character set, configure the NLS_LANG environment variable, adjust terminal encoding, and ensure client‑server encoding consistency.

ITPUB
ITPUB
ITPUB
Fix Chinese Garbled Text in Oracle SQL*Plus on Windows and Linux

Problem Overview

The author experiences Chinese characters displaying correctly in SQL*Plus on Windows, but appearing as garbled text when using PL/SQL on Windows and when accessing Oracle via SSH on Linux.

1. Verify Oracle Server Character Set

Open a command prompt and run the following query:

SQL> select userenv('language') from dual; Result: AMERICAN_AMERICA.ZHS16GBK

An illustration of the query output is shown in the first image.

2. Configure PL/SQL Client Encoding on Windows

Set the NLS_LANG system environment variable to match the server encoding:

Variable name: NLS_LANG Variable value: SIMPLIFIED CHINESE_CHINA.ZHS16GBK The setting is shown in the second image.

3. Verify Linux Client Encoding

On the Oracle server, check the profile files:

vim /home/oracle/.bash_profile Typical entries: export LANG=en_US.gbk export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK

Run the same select userenv('language') query on Linux; it also returns AMERICAN_AMERICA.ZHS16GBK, but Chinese text is still garbled.

4. Adjust Terminal Encoding (Xshell)

The Xshell terminal window was defaulting to UTF‑8, which conflicted with the GBK‑encoded data. Changing the terminal’s character set to GBK (or the system’s default language setting) resolves the display issue.

Conclusion

Correct Chinese display in Oracle requires that the client’s character set (SQL*Plus, PL/SQL, SSH terminal) matches the server’s AMERICAN_AMERICA.ZHS16GBK setting. Adjusting NLS_LANG on Windows and ensuring the Linux terminal uses GBK eliminates the garbled output.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

LinuxWindowsOraclePL/SQL
ITPUB
Written by

ITPUB

Official ITPUB account sharing technical insights, community news, and exciting events.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.