Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit4c35ec5

Browse files
committed
Allow 4 bytes UTF-8 (UCS-4 range 00010000-001FFFFF)
This is necessary to support JIS X 0213 <--> UTF-8 conversion.
1 parent6b77e3a commit4c35ec5

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed
Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#
2-
# $PostgreSQL: pgsql/src/backend/utils/mb/Unicode/ucs2utf.pl,v 1.2 2003/11/29 22:40:01 pgsql Exp $
3-
# convert UCS-2 to UTF-8
2+
# Copyright (c) 2001-2007, PostgreSQL Global Development Group
3+
#
4+
# $PostgreSQL: pgsql/src/backend/utils/mb/Unicode/ucs2utf.pl,v 1.3 2007/03/23 13:51:30 ishii Exp $
5+
# convert UCS-4 to UTF-8
46
#
57
subucs2utf {
68
local($ucs)=@_;
@@ -10,11 +12,16 @@ sub ucs2utf {
1012
$utf=$ucs;
1113
}elsif ($ucs>0x007f&&$ucs<=0x07ff) {
1214
$utf= (($ucs &0x003f)|0x80)| ((($ucs>>6)|0xc0)<<8);
13-
}else {
15+
}elsif ($ucs>0x07ff&&$ucs<=0xffff) {
1416
$utf= ((($ucs>>12)|0xe0)<<16)|
1517
(((($ucs &0x0fc0)>>6)|0x80)<<8)|
1618
(($ucs &0x003f)|0x80);
17-
}
19+
}else {
20+
$utf= ((($ucs>>18)|0xf0)<<24)|
21+
(((($ucs &0x3ffff)>>12)|0x80)<<16)|
22+
(((($ucs &0x0fc0)>>6)|0x80)<<8)|
23+
(($ucs &0x003f)|0x80);
24+
}
1825
return($utf);
1926
}
2027
1;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp