Special characters are not displaying properly from Client Tools in Teradata

Problem:

My colleague can read data with special character correctly, but I can’t read it properly from my client tools.

 

Cause:

If you use something more than the simplest characters that occur in Western languages, then people may not be able to read your text, unless you tell them which character encoding you used. Words and sentences in text are built up with signs. Examples of signs are á in the Latin alphabet, and the Chinese ideogram and the sign in devanagari. A character encoding is a key to unlock (ie "crack") the code. One such key is a set of images between the bytes representing numbers inside the computer, and characters in the encoded character set. Without a key, data will not look meaningful.

 

Example:

In that example, I created a table “Employee” and inserted data with character set ASCII and when I changed my session character set to UTF 8 then the data with special character is not properly visible and vice versa when I create a table “Employee2” and inserted data with character set UTF 8 and accessing data with character set ASCII then the data with special character is not display properly. I used client tools bteq for the demonstration, but I have also demonstrated how to check session/connection character set from tools Teradata Studio or ODBC client.

 

-- Set Session Character set to  'ASCII'

BTEQ -- Enter your SQL request or BTEQ command:

.set session charset 'ASCII';

 

-- Check the session property

BTEQ -- Enter your SQL request or BTEQ command:

.foldline on all

BTEQ -- Enter your SQL request or BTEQ command:

.sidetitles on

BTEQ -- Enter your SQL request or BTEQ command:

help session;

*** Warning: Report has more than 100 column(s).

              Only the first 100 column(s) will be displayed.

………………..

………………..

                   Character Set ASCII

………………..

………………..

BTEQ -- Enter your SQL request or BTEQ command:

CREATE SET TABLE USER1.Employee, FALLBACK

   (ID INT,

    Name   CHAR(25)

)

UNIQUE PRIMARY INDEX (ID);

*** Table has been created.

BTEQ -- Enter your SQL request or BTEQ command:

insert into  USER1.Employee values(1,'Hans Högman');

*** Insert completed. One row added.

BTEQ -- Enter your SQL request or BTEQ command:

select * from USER1.Employee;

         ID  Name

-----------  -------------------------

          1  Hans Högman

-- Change the session to UTF8

BTEQ -- Enter your SQL request or BTEQ command:

.set session charset 'UTF8';

BTEQ -- Enter your SQL request or BTEQ command:

select * from USER1.Employee;

           ID  Name

-----------  --------------------------------------------------

          1  Hans Högman

BTEQ -- Enter your SQL request or BTEQ command:

CREATE SET TABLE USER1.Employee2, FALLBACK

   (ID INT,

    Name   CHAR(25)

)

UNIQUE PRIMARY INDEX (ID);

*** Table has been created.

 

BTEQ -- Enter your SQL request or BTEQ command:

insert into  USER1.Employee2 values(1,'Jonas Lindström');

*** Insert completed. One row added.

BTEQ -- Enter your SQL request or BTEQ command:

select * from A82893.Employee2;

         ID  Name

-----------  --------------------------------------------------

          1  Jonas Lindström

BTEQ -- Enter your SQL request or BTEQ command:

.set session charset 'ASCII';

BTEQ -- Enter your SQL request or BTEQ command:

select * from USER1.Employee2;

 *** Query completed. One row found. 2 columns returned.

         ID  Name

-----------  -------------------------

          1  Jonas Lindstrm

 

You can change the character set from Teradata Studio Property:


If you are using ODBC or Teradata Assistant that using ODBC then you can change it from the ODBC driver connection setup



Note:

To be available for use, a client character set must be listed in the DBC.CharTranslationsV view and the Install Flag must be set to Y. By default, none of the standard Teradata client character set translation codes in DBC.CharTranslationsV are enabled.

 The ASCII, EBCDIC, UTF8 and UTF16 client character sets are permanently enabled and do not appear in DBC.CharTranslationsV.

 To use one of the four permanently enabled client character sets (ASCII, EBCDIC, UTF8, and UTF16), enable the character set as a client default.

 

Comments