diff options
author | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-12-01 01:20:56 +0000 |
---|---|---|
committer | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-12-01 01:20:56 +0000 |
commit | ed22b0ecee668cbd58d469c05b10e74cd6f604ab (patch) | |
tree | 496270e7eac9d33121e47a86b280a92deff920df | |
parent | 54fd6de064142633f3bb592b0bd6486d262cd2b2 (diff) | |
download | ruby-ed22b0ecee668cbd58d469c05b10e74cd6f604ab.tar.gz |
* string.c (rb_str_inspect): fix typo (not 0xFD but 0xFE).
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29989 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | string.c | 2 | ||||
-rw-r--r-- | test/ruby/test_m17n.rb | 11 |
3 files changed, 16 insertions, 1 deletions
@@ -1,3 +1,7 @@ +Wed Dec 1 10:16:41 2010 NARUSE, Yui <naruse@ruby-lang.org> + + * string.c (rb_str_inspect): fix typo (not 0xFD but 0xFE). + Wed Dec 1 09:28:27 2010 NARUSE, Yui <naruse@ruby-lang.org> * addr2line.c: Follow .gnu_debuglink section. @@ -4217,7 +4217,7 @@ rb_str_inspect(VALUE str) const unsigned char *q = (const unsigned char *)p; if (q[0] == 0xFE && q[1] == 0xFF) enc = rb_enc_find("UTF-16BE"); - else if (q[0] == 0xFF && q[1] == 0xFD) + else if (q[0] == 0xFF && q[1] == 0xFE) enc = rb_enc_find("UTF-16LE"); else unicode_p = 0; diff --git a/test/ruby/test_m17n.rb b/test/ruby/test_m17n.rb index cfe7ed4d3d..b6dac01017 100644 --- a/test/ruby/test_m17n.rb +++ b/test/ruby/test_m17n.rb @@ -243,6 +243,17 @@ class TestM17N < Test::Unit::TestCase s.dup.force_encoding(enc).inspect) end end + + str = "\uFEFF\u3042" + %w/UTF-16 UTF-32/.each do |enc| + %w/BE LE/.each do |endian| + s = str.encode(enc + endian) + # When a UTF-16/32 string doesn't have a BOM, + # inspect as a dummy encoding string. + assert_equal(s.inspect, + s.dup.force_encoding(enc).inspect) + end + end end def test_str_dump |