Document Type | Troubleshooting
Category | Administration/Configuration
Applicable Product Versions | 6FS07, 6FS07PS
Document Number | TADTS007
Issue
When accessing the DB or executing SQL scripts through the Tibero Client, Korean characters may appear corrupted. This document provides guidance on what to check and how to address encoding issues.
Cause
Causes and Checks When Korean Characters Are Corrupted
1. DB Character Set
2. Terminal encoding
3. TB_NLS_LANG
4. Encoding of the script file
NoteIf the DB isMSWIN949, specify the script encoding as euc-kr. ( It processes Korean characters as 2 bytes, same asMSWIN949)
Solutions
Check DB CharacterSet
Check the database character set. (NLS_CHARACTERSET)
$ tbsql sys/tibero SQL> SELECT * FROM DATABASE_PROPERTIES WHERE NAME LIKE '%NLS%'; NAME VALUE COMMENT_ST ------------------------- ---------- ---------- NLS_CHARACTERSET UTF8 NLS_NCHAR_CHARACTERSET UTF16 2 rows selected.
Check Terminal Encoding
If the DB CharacterSet and the connected Terminal encoding differ, Korean characters may appear corrupted.
DB | TERMINAL | Output Result |
|---|---|---|
MSWIN949 | UTF8 | Korean characters corrupted |
MSWIN949 | EUC-KR or use font encoding | Korean characters display correctly |
Set TB_NLS_LANG Environment Variable (tbdsn.tbr)
- If matching DB CharacterSet and Terminal encoding is difficult, specify the encoding in the tbdsn.tbr file using TB_NLS_LANG.
- Set TB_NLS_LANG to the connected Terminal encoding to inform the DB of the terminal encoding in use.
DB | TERMINAL | TB_NLS_LANG | Output Result |
|---|---|---|---|
MSWIN949 | UTF8 | UTF8 | Korean characters display correctly |
Check Script File Encoding
Check the encoding of the script file to be inserted.
1) If Korean characters appear corrupted in vi editor
case 1. After entering vi editor, press ESC > type :set encoding=utf=8 and then use
case 2. Or change the settings as follows.
$ vi /etc/vimrc set encoding=utf-8 set fileencodings=utf-8,cp949
2) Change the encoding of the script file to be inserted
f: original encoding- Check current encoding
$ file tmaxkorean.sql
tmaxkorean.sql: UTF-8 Unicode text
- Check available encodings
$ iconv -l | grep {encoding_type}
- Convert encoding
$ iconv -f {original_encoding} -t {target_encoding} tmaxkorean.sql > t.sql
$ iconv -f utf-8 -t EUCKR tmaxkorean.sql > t.sql