Project

General

Profile

Bug #10114

Updated by nobu (Nobuyoshi Nakada) over 10 years ago

~~~ruby ~~~ 
 #!/usr/bin/env ruby 
 # -*- coding: utf-8 -*- 

 code = 'def n "∈"; end' 
 puts "code.encoding: #{code.encoding} #{code.valid_encoding?}" 

 begin 
   instance_eval(code) 
 rescue SyntaxError => error 
   puts "error.message.encoding: #{error.message.encoding} #{error.message.valid_encoding?}" 
 end 
 ~~~ 

 Outputs the following: 

 
 ~~~ 
 code.encoding: UTF-8 true 
 error.message.encoding: ASCII-8BIT true 
 ~~~ 

 but I expect error.message.encoding to be UTF-8. 



Back