mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* enc/trans/utf8_mac.trans (buf_apply): fix for patterns
whose result is 2 bytes. [ruby-core:30751] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28307 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
051af24359
commit
78f5b54f1b
4 changed files with 17 additions and 10 deletions
|
@ -1,3 +1,8 @@
|
|||
Sun Jun 13 02:12:46 2010 NARUSE, Yui <naruse@ruby-lang.org>
|
||||
|
||||
* enc/trans/utf8_mac.trans (buf_apply): fix for patterns
|
||||
whose result is 2 bytes. [ruby-core:30751]
|
||||
|
||||
Sun Jun 13 01:38:17 2010 NARUSE, Yui <naruse@ruby-lang.org>
|
||||
|
||||
* time.c (rb_localtime_r2): fix mixed declarations and code.
|
||||
|
|
|
@ -150,10 +150,10 @@ buf_apply(int mode, struct from_utf8_mac_status *sp, unsigned char *o)
|
|||
next_info = get_info(next_info, sp);
|
||||
switch (next_info & 0x1F) {
|
||||
case THREEbt:
|
||||
o[n++] = getBT1(next_info);
|
||||
case TWObt:
|
||||
o[n++] = getBT1(next_info);
|
||||
o[n++] = getBT2(next_info);
|
||||
o[n++] = getBT3(next_info);
|
||||
if (THREEbt == (next_info & 0x1F)) o[n++] = getBT3(next_info);
|
||||
if (mode == 3) {
|
||||
buf_clear(sp);
|
||||
}
|
||||
|
|
|
@ -892,12 +892,4 @@ class TestEncodingConverter < Test::Unit::TestCase
|
|||
"".encode("euc-jp", :undef => :replace, :replace => broken)
|
||||
}
|
||||
end
|
||||
|
||||
def test_utf8_mac
|
||||
assert_equal("\u{fb4d}", "\u05DB\u05BF".encode("UTF-8", "UTF8-MAC"))
|
||||
assert_equal("\u{1ff7}", "\u03C9\u0345\u0342".encode("UTF-8", "UTF8-MAC"))
|
||||
|
||||
assert_equal("\u05DB\u05BF", "\u{fb4d}".encode("UTF8-MAC").force_encoding("UTF-8"))
|
||||
assert_equal("\u03C9\u0345\u0342", "\u{1ff7}".encode("UTF8-MAC").force_encoding("UTF-8"))
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1912,6 +1912,16 @@ class TestTranscode < Test::Unit::TestCase
|
|||
assert_equal(Encoding::Shift_JIS, b.encoding)
|
||||
end
|
||||
|
||||
def test_utf8_mac
|
||||
assert_equal("\u{fb4d}", "\u05DB\u05BF".encode("UTF-8", "UTF8-MAC"))
|
||||
assert_equal("\u{1ff7}", "\u03C9\u0345\u0342".encode("UTF-8", "UTF8-MAC"))
|
||||
|
||||
assert_equal("\u05DB\u05BF", "\u{fb4d}".encode("UTF8-MAC").force_encoding("UTF-8"))
|
||||
assert_equal("\u03C9\u0345\u0342", "\u{1ff7}".encode("UTF8-MAC").force_encoding("UTF-8"))
|
||||
|
||||
check_both_ways("\u{e9 74 e8}", "e\u0301te\u0300", 'UTF8-MAC')
|
||||
end
|
||||
|
||||
def test_fallback
|
||||
assert_equal("\u3042".encode("EUC-JP"), "\u{20000}".encode("EUC-JP",
|
||||
fallback: {"\u{20000}" => "\u3042".encode("EUC-JP")}))
|
||||
|
|
Loading…
Reference in a new issue