* 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:
nobu 2007-10-16 18:06:31 +00:00
Родитель b1d53d10e2
Коммит 59609a4fba
2 изменённых файлов: 6 добавлений и 5 удалений

Просмотреть файл

@ -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>
* string.c (rb_str_ord): use encoding.

Просмотреть файл

@ -121,11 +121,7 @@ static int
utf8_code_to_mbclen(OnigCodePoint code, OnigEncoding enc)
{
if ((code & 0xffffff80) == 0) return 1;
else if ((code & 0xfffff800) == 0) {
if (code <= 0xff && code >= 0xfe)
return 1;
return 2;
}
else if ((code & 0xfffff800) == 0) return 2;
else if ((code & 0xffff0000) == 0) return 3;
else if ((code & 0xffe00000) == 0) return 4;
else if ((code & 0xfc000000) == 0) return 5;