Databases 6 min read

How to Fix SQL*Plus Garbled Characters: Master OS, Client, and Oracle Charsets

This guide explains the three essential character sets—operating system (LANG), Oracle database (NLS_CHARACTERSET), and client (NLS_LANG)—and provides step‑by‑step instructions with screenshots to resolve SQL*Plus display garbling issues.

ITPUB
ITPUB
ITPUB
How to Fix SQL*Plus Garbled Characters: Master OS, Client, and Oracle Charsets

Character Set Overview

Three related character sets affect Oracle client display:

Operating system charset – controlled by the LANG environment variable on the client machine. It must be a superset of the database charset; otherwise characters may appear garbled.

Database charset – defined by the NLS_CHARACTERSET parameter. Query with

SELECT value FROM nls_database_parameters WHERE parameter='NLS_CHARACTERSET';

. Changing it is only safe when the new charset is a strict superset (e.g., UTF8AL32UTF8).

Client charset – defined by NLS_LANG. If unset, the client inherits the default value from the Oracle installation.

Prerequisite: Verify Subset‑Superset Relationship

Oracle documentation lists valid binary subset‑superset pairs (e.g., WE8MSWIN1252AL32UTF8). Ensure the OS charset, NLS_LANG, and NLS_CHARACTERSET belong to the same family.

Step‑by‑Step Procedure (Linux client)

1. Check the OS charset

locale

The output shows the current LANG value, e.g., en_US.UTF-8.

Locale output
Locale output

2. Install Chinese language support (if missing)

If the system lacks Chinese locale packages, setting LANG alone will not enable Chinese rendering.

Missing Chinese support
Missing Chinese support

3. Add Chinese support via YUM

sudo yum -y groupinstall "chinese-support"

After installation, Chinese characters can be displayed correctly.

Chinese support installed
Chinese support installed

4. Test with two Oracle instances

Two databases are used for demonstration: PROD1 – charset WE8MSWIN1252 (Western European). PROD5 – charset AL32UTF8 (Unicode).

When NLS_LANG is unset, the client inherits the installation defaults ( AMERICAN_AMERICA.WE8MSWIN1252 for PROD1, SIMPLIFIED CHINESE_CHINA.AL32UTF8 for PROD5).

Instance settings
Instance settings
Instance settings 2
Instance settings 2

5. Resolve garbled Chinese on PROD5

Initially PROD5 shows unreadable Chinese characters while PROD1 displays English correctly. Set NLS_LANG to match the database charset:

export NLS_LANG=SIMPLIFIED_CHINESE_CHINA.AL32UTF8

After exporting the variable, Chinese text is rendered properly.

After setting NLS_LANG
After setting NLS_LANG
Chinese displayed
Chinese displayed
Final result
Final result
Final result 2
Final result 2

Conclusion

The client‑side display of Oracle data is governed by NLS_LANG. When Chinese characters appear garbled, first confirm that the database NLS_CHARACTERSET supports Chinese (e.g., AL32UTF8 or ZHS16GBK). If the database charset does not support the language, no client configuration can render the characters correctly. Refer to Oracle’s official “Binary Subset‑Superset Pairs” documentation for supported encodings.

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.

Oracleutf8NLS_LANGSQLPlus
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.