简体   繁体   English

DB2代码从Unicode转换为ISO8859-2并返回

[英]DB2 Code conversion from Unicode to ISO8859-2 and back

When saving some string from XML (UTF8 encoded) containing Latvian capital (Rīga). 从包含拉脱维亚大写字母(Rīga)的XML(UTF8编码)保存字符串时。 Riga comes this I with macron ( Unicode ) to DB2. 里加将此I与Macron( Unicode )一起提供给DB2。

Database code page is not Unicode but unfortunately ISO8859-2. 数据库代码页不是Unicode,但不幸的是ISO8859-2。 Conversion occurs and this special I gets substituted with X'1A (( explained here IBM docs )) 发生转换,并且我用X'1A代替了这个特殊字符(( 在此解释IBM docs ))

Again when I use same columns to reproduce original XML my validation fails with: 同样,当我使用相同的列重现原始XML时,我的验证因以下原因而失败:

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? 他们为什么选择无效的XML字符作为替换,以及执行此操作的首选方式是什么?

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. 我们使用Java来进行XML输入和输出,并且不需要使用Macron来保留I,某种替换字符是可以的,不会与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 )

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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