ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 字符集 AL32UTF8 和 UTF8

字符集 AL32UTF8 和 UTF8

原创 Linux操作系统 作者:john296266807 时间:2010-10-20 14:12:08 0 删除 编辑
The difference between UTF8 and AL32UTF8 are:
&o4g&S3Y4Yec'o0ITPUB个人空间~3L$T5Q$fm
UTF8 stores Unicode characters with code points > U+FFFF as two surrogate characters, three bytes each ITPUB个人空间3|f&W+EuC Fi
ITPUB个人空间wS[r(h7|"z-s!gW
AL32UTF8 stores Unicode characters with code points > U+FFFF as one four-byte character
n[2X _P9x0
N,p1~ KSV0

UTF8 will not be updated anymore when new Unicode versions are released, only AL32UTF8 and AL16UTF16 will. ITPUB个人空间&R'xP6^Q9oiV4]

!u8X!Hy#i'c!p0Due to compatibility problems with pre-9i versions use UTF8 if you have Oracle8i clients connecting to the database. Use AL32UTF8 in pure Oracle9i environment.
p3R y+q_O0ITPUB个人空间&b U5`^:T:KK
UTF-8 encoding is variable-width. In UTF-8, each character can be represented by either one, two, or three bytes.
O;i&d X6`6iawxr0
%u/x?%H!~0UTF8 is a varying width 1-3 bytes per character Unicode encoding. It is supported for both database and national character sets. It is a binary superset of US7ASCII. UTF8 corresponds to Unicode CESU-8 encoding. ITPUB个人空间0^.t!cW YIq[ u!a
ITPUB个人空间hd MB,T9_ w/zH
AL32UTF8 is a varying width 1-4 bytes per character. It is supported for CHAR, VARCHAR2, LONG and CLOB only (database character set). It is a binary superset of UTF8 (in 9.2 only) and US7ASCII. AL32UTF8 corresponds to Unicode UTF-8 encoding.

This is what Metalink says. In Note: 237593.1 ITPUB个人空间j;|n8xRR

L,Weh&ad3zfU0t dc0There is a possible problem for 817 and lower versions: Problems connecting to AL32UTF8 databases from older versions 8i and lower.
;W0fyGH2H0
k@UZH_}0The default UTF8 characterset for 9i/10G is AL32UTF8, however this characterset is NOT recognised by any pre-9i clients/server systems.ITPUB个人空间5iD^$qz9O
ITPUB个人空间1l%Jf2S:v0vnNX,g
Oracle recommends that you use UTF8 instead of AL32UTF8 as database characterset if you have 8i (or older) servers and clients connecting to the 9i/10g system until you can upgrade the older versions.ITPUB个人空间7x-B!I)Q&U3C u

(x.a,WI Js0UTF8 is unicode revision 3.0 in 8.1.7 and up. AL32UTF8 is Unicode 3.0 in 9.0.1, Unicode 3.1 in 9.2, Unicode 3.2 in 10.1 and Unicode 4.01 in 10.2
,WBC!s'L:Nv[vZ0
^$u)t^U2JUb G0Besides the difference in Unicode version the "big difference" is that AL32UTF8 has build in support for "Surrogate Pairs" (also known as Surrogate characters or "Supplementary characters").
P b-~P lJ-q0Practically this means that in 99% of the cases you can use UTF8 instead of AL32UTF8 without any problem.
5Da-_R%E~6o0ITPUB个人空间AT]H.J8~~"JKr
There are only a few situations where Surrogate Pairs are already used on client side. Windows system with HKSCS2001 (hong kong extension) is one of those. Note that you actually can *store* Surrogate Pairs in UTF8 but will store 2 * 3 byte characters and not like AL32UTF8 one 4 byte character.ITPUB个人空间,k z5L*z4O#_1|0M
ITPUB个人空间:AD@ M,[(rF
Note that if you now use UTF8 as database characterset and -in the future you do a roll out of new 9i or higher clients and all your other databases are upgraded to 9i or higher, you can simply do a alter database characterset to go from UTF8 to AL32UTF8 so downtime will be limited to a few minutes if the need to go to AL32UTF8 should arise. There is no performance impact on staying on UTF8
@(D Cez0
Bt G&q"r0u"w @0NOTE:
S}ME9gAA0This note is ONLY relevant if you have already a 9i AL32UTF8 database with data in. If you still need to create the 9i system then choose UTF8 instead of AL32UTF8 as database characterset in the database creation assistant.ITPUB个人空间B`uuUm8NG:O0P$W~
ITPUB个人空间/G,dG6|c4~8Y
So, *IF* you have already a 9i system running with AL32UTF8 then you can use the following steps in this note to change the database characterset to UTF8 without losing data.
s*q'DJ4Iny U1T0ITPUB个人空间m+l,o/v*A6?g
You can't simply use "ALTER DATABASE CHARACTERSET" to go from AL32UTF8 to UTF8 because UTF8 is a SUB-set of AL32UTF8 (some codepoints which are correct in AL32UTF8 are not known in UTF8)ITPUB个人空间$]Af.ckU

-IU x a dkg(W0But again, UTF8 *contains* all characters know in AL32UTF8, the difference between them is pure the way some characters are stored (AL32UTF8 is a bit more efficient for some characters)
"q,i{7h'{DSO\^V]0ITPUB个人空间B#vuX jB I
So you will run into ORA-12712 if you try alter database ...

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/21074940/viewspace-676368/ ,如需转载,请注明出处,否则将追究法律责任。

上一篇: 没有了~
下一篇: 没有了~
请登录后发表评论 登录
全部评论

注册时间:2009-03-18

  • 博文量
    1
  • 访问量
    3098