From 596ca948b1d6f2d22b39a4a9c042cc3d164eae13 Mon Sep 17 00:00:00 2001 From: nobu Date: Tue, 23 Apr 2013 02:58:51 +0000 Subject: string.c: fix for UTF-32 * string.c (rb_str_scrub): fix for UTF-32. strlen() on strings contain NUL returns wrong result, use sizeof operator instead. [ruby-dev:45975] [Feature #6752] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40417 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_m17n.rb | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'test') diff --git a/test/ruby/test_m17n.rb b/test/ruby/test_m17n.rb index 60834bb9c6..9d92fbc6a9 100644 --- a/test/ruby/test_m17n.rb +++ b/test/ruby/test_m17n.rb @@ -1522,5 +1522,11 @@ class TestM17N < Test::Unit::TestCase assert_equal("\uFFFD\u3042".encode("UTF-16LE"), "\x00\xD8\x42\x30".force_encoding(Encoding::UTF_16LE). scrub) + assert_equal("\uFFFD".encode("UTF-32BE"), + "\xff".force_encoding(Encoding::UTF_32BE). + scrub) + assert_equal("\uFFFD".encode("UTF-32LE"), + "\xff".force_encoding(Encoding::UTF_32LE). + scrub) end end -- cgit v1.2.3