we8iso8859p1 java,Oracle中的NLS_CHARACTERSET WE8ISO8859P1和UTF8问题

I am currently using a Database in oracle which has NLS_CHARACTERSET WE8ISO8859P1 so lets say I store a value in varchar2 field which is maž (accented character) so in database it gets stored as maå¾ . Now when I try to retrieve it with query select * from table where fieldValue = 'maž' it returns 0 rows, and then when i try to insert it again it gives me a constraint error saying value already exist.

How to overcome such situation.

I am doing this via Java code

解决方案

Oracle Character Set Name: WE8ISO8859P1

Description: Western European 8-bit ISO 8859 Part 1

Region: WE (Western Europe)

Number of Bits Used to Represent a Character: 8

On the other hand, UTF-8 uses several bytes to store a symbol.

If your database uses WE8ISO8859P1 and the column type is from VARCHAR group (not NVARCHAR) and you're inserting a symbol which code > 255, this symbol will be transformed to WE8ISO8859P1 and some information will be lost.

To put it simply, if you're inserting UTF-8 into a db with single-byte character set, your data is lost.

The link above describes different scenarios how to tackle this issue.

You can also try Oracle asciistr/unistr functions, but in general it's not a good way to deal with such problems.

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值