简体   繁体   中英

DB2 Code conversion from Unicode to ISO8859-2 and back

When saving some string from XML (UTF8 encoded) containing Latvian capital (Rīga). Riga comes this I with macron ( Unicode ) to DB2.

Database code page is not Unicode but unfortunately ISO8859-2. Conversion occurs and this special I gets substituted with X'1A (( explained here IBM docs ))

Again when I use same columns to reproduce original XML my validation fails with:

An invalid XML character (Unicode: 0x1a) was found in the element content of the document.

Why did they choose invalid XML character as substitution and what's preferred way to do this kind of thing?

We are using Java for XML input and output and do not need to preserve I with macron, some kind of replacment charater would be fine, one that doesn't mess with XML. Filtering all characters that's not representable in the database code page doesn't seam as good idea?

您是否尝试过将列转换回unicode?

CAST(column AS VARCHAR(255) CCSID UNICODE )

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM