From: "lancel (lancel lancel)" Date: 2012-11-22T10:46:47+09:00 Subject: [ruby-core:49843] [ruby-trunk - Bug #7076] TestUnicodeEscape#test_basic failure on Windows Issue #7076 has been updated by lancel (lancel lancel). =begin All of us have read the stories of excite people's (()) mind, the hero of the story to live only for a very limited time, sometimes up to a year, sometimes as short as one day. But we always want to know, the doomed choose how to spend their (()) last days. Of course, I say is of free men who have a choice, not whose sphere of activities is strictly.458gyu854 =end ---------------------------------------- Bug #7076: TestUnicodeEscape#test_basic failure on Windows https://bugs.ruby-lang.org/issues/7076#change-33427 Author: h.shirosaki (Hiroshi Shirosaki) Status: Closed Priority: Normal Assignee: Category: test Target version: ruby -v: ruby 2.0.0dev (2012-09-27 trunk 37040) [i386-mingw32] =begin This was originally reported at rubyinstaller-list by Jon. With chcp 437, TestUnicodeEscape#test_basic fails with invalid byte sequence in UTF-8. http://pastie.org/4688083 I got the following test failure with chcp 437 on Windows 7. 1) Failure: test_basic(TestUnicodeEscape) [c:/Users/hiroshi/work/ruby/test/ruby/test_unicode_escape.rb:50]: Expected /^("?)\u00FC\1$/ to match "\"??\"\n". echo command on Windows seems not to work properly against non-ascii characters with all code page. I suggest a patch to use ruby instead of echo. This patch works fine with chcp 437, 1252 and 65001. Jon also confirmed this. diff --git a/test/ruby/test_unicode_escape.rb b/test/ruby/test_unicode_escape.rb index 088f81c..2c437d9 100644 --- a/test/ruby/test_unicode_escape.rb +++ b/test/ruby/test_unicode_escape.rb @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- require 'test/unit' +require_relative 'envutil' class TestUnicodeEscape < Test::Unit::TestCase def test_basic @@ -47,7 +48,7 @@ EOS # \u in %x strings assert_match(/^("?)A\1$/, `echo "\u0041"`) #" assert_match(/^("?)A\1$/, %x{echo "\u0041"}) #" - assert_match(/^("?)��\1$/, `echo "\u{FC}"`.force_encoding("utf-8")) #" + assert_match(/^("?)��\1$/, `#{EnvUtil.rubybin} -e "puts \\"\u{FC}\\""`.force_encoding("utf-8")) #" # \u in quoted symbols assert_equal(:A, :"\u0041")=end -- http://bugs.ruby-lang.org/