Euro symbol and DB2 database codeset

This problem of Euro symbol was diagnosed on this platform:

Red Hat Linux 4.6
DB2 V9.5.0.0
Database
 Database territory   = US
 Database code page   = 1208
 Database code set    = UTF-8

A developer outlined a problem where: When euro symbol was inserted – it converts as 3 characters . Therefore if a  varchar(50) column is defined , and a euro exists , it will attempt to store 52 characters .and throws a TRUNCATE error

The Problem was  confirmed via creating a test table in MYDB called “mytesttable”.
Note: Database code set   = UTF-8

Executed an INSERT statement :

INSERT INTO mytesttable(ID,VALUES) VALUES (1,'€')
SELECT length(values) FROM mytesttable
Result = 3

I then created  a new database with different codeset :  and recreated the same table , running the same code
This time the database was set up with database code set   = 1252

I executed the same statement :
Executed an INSERT statement :

INSERT INTO mytesttable(ID,VALUES) VALUES (1,'€')
SELECT length(values) FROM mytesttable
Result = 1

 

Leave a Reply

Discover more from ciquery

Subscribe now to keep reading and get access to the full archive.

Continue reading