зеркало из https://github.com/github/ruby.git
* enc/utf8.c (utf8_code_to_mbclen): 0xfe and 0xff are valid Unicode to
be encoded to 2bytes in UTF-8. [ruby-core:12700] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13727 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
b1d53d10e2
Коммит
59609a4fba
|
@ -1,3 +1,8 @@
|
||||||
|
Wed Oct 17 03:06:30 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* enc/utf8.c (utf8_code_to_mbclen): 0xfe and 0xff are valid Unicode to
|
||||||
|
be encoded to 2bytes in UTF-8. [ruby-core:12700]
|
||||||
|
|
||||||
Wed Oct 17 02:50:49 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Wed Oct 17 02:50:49 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* string.c (rb_str_ord): use encoding.
|
* string.c (rb_str_ord): use encoding.
|
||||||
|
|
|
@ -121,11 +121,7 @@ static int
|
||||||
utf8_code_to_mbclen(OnigCodePoint code, OnigEncoding enc)
|
utf8_code_to_mbclen(OnigCodePoint code, OnigEncoding enc)
|
||||||
{
|
{
|
||||||
if ((code & 0xffffff80) == 0) return 1;
|
if ((code & 0xffffff80) == 0) return 1;
|
||||||
else if ((code & 0xfffff800) == 0) {
|
else if ((code & 0xfffff800) == 0) return 2;
|
||||||
if (code <= 0xff && code >= 0xfe)
|
|
||||||
return 1;
|
|
||||||
return 2;
|
|
||||||
}
|
|
||||||
else if ((code & 0xffff0000) == 0) return 3;
|
else if ((code & 0xffff0000) == 0) return 3;
|
||||||
else if ((code & 0xffe00000) == 0) return 4;
|
else if ((code & 0xffe00000) == 0) return 4;
|
||||||
else if ((code & 0xfc000000) == 0) return 5;
|
else if ((code & 0xfc000000) == 0) return 5;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче