Issue #5390 has been updated by Ayumu AIZAWA.



YAML::ENGINE.yamler ??? syck ???水???????障?????
ruby1.9.2 ??????篏帥?????翫????? require 'yaml' ???????????? require 'psych' ????????? YAML::ENGINE.yamler = 'psych' ????????篁ヤ???????????Psych::SyntaxError???????障?????

 ---- ruby 2.0.0dev
 $ cat bug_5390.rb 
 # coding: Shift_JIS
 require 'yaml'
 text = '["?\"]'
 p YAML::ENGINE.yamler
 p text.encoding
 str = YAML.load(text).first
 
 $ ruby -v bug_5390.rb 
 ruby 2.0.0dev (2011-12-30 trunk 34161) [x86_64-darwin10.8.0]
 "psych"
 #<Encoding:Shift_JIS>
 /Users/ayumin/tmp/ruby/lib/ruby/2.0.0/psych.rb:192:in `parse': (<unknown>): invalid leading UTF-8 octet at line 1 column 1 (Psych::SyntaxError)
 	from /Users/ayumin/tmp/ruby/lib/ruby/2.0.0/psych.rb:192:in `parse_stream'
 	from /Users/ayumin/tmp/ruby/lib/ruby/2.0.0/psych.rb:150:in `parse'
 	from /Users/ayumin/tmp/ruby/lib/ruby/2.0.0/psych.rb:126:in `load'
 	from bug_5390.rb:6:in `<main>'

 ---- ruby1.9.2

 $ cat bug_5390.rb 
 # coding: Shift_JIS
 require 'yaml'
 text = '["?\"]'
 YAML::ENGINE.yamler = 'psych'
 str = YAML.load(text).first
 
 $ ruby -v bug_5390.rb 
 ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-darwin10.8.0]
 /Users/ayumin/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/psych/deprecated.rb:79: warning: method redefined; discarding old to_yaml_properties
 /Users/ayumin/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/syck/rubytypes.rb:13: warning: previous definition of to_yaml_properties was here
 /Users/ayumin/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/psych.rb:148:in `parse': couldn't parse YAML at line 1 column 0 (Psych::SyntaxError)
 	from /Users/ayumin/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/psych.rb:148:in `parse_stream'
 	from /Users/ayumin/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/psych.rb:119:in `parse'
 	from /Users/ayumin/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/psych.rb:106:in `load'
 	from bug_5390.rb:5:in `<main>'
  


----------------------------------------
Bug #5390: YAML.load ??????罩c????f????с?????????潟?潟?若????c?潟?違???絖?????????????篁??????????障??
https://bugs.ruby-lang.org/issues/5390

Author: yu nobuoka
Status: Assigned
Priority: Normal
Assignee: Aaron Patterson
Category: 
Target version: 2.0.0
ruby -v: ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-linux]


[[ruby-list:48419]] ???????井?宴????с?????????????????????荅宴??????????障????????с????違??????怨???????障?????

YAML.load ???????????????茖????????????????????潟?若?????菴純??????????????c?????с?????????????????荀?????????????筝??????????????絖????????潟?潟?若????c?潟?違??羂??????????????若?鴻????????????????????????障????? ?????????????Shift_JIS ???????????潟?潟?若????c?潟?違???絖????????????罩c?????????若?鴻?с????障????????

 --- source code ---
 # coding: Shift_JIS
 require "yaml"
 text = '[ "???" ]' # Shift_JIS ??? '???' ??? 2 ?????ゃ?????????????鴻?????激?ャ???????????ゃ?????
 str = YAML.load( text ).first # ????主?榊??

 --- output ---
 /home/nobuoka/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/syck.rb:135:in `load': syntax error on line 0, col 9: `' (ArgumentError)
 	from /home/nobuoka/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/syck.rb:135:in `load'
 	from yaml_cp932.rb:4:in `<main>'

Shift_JIS ????絖??????с????祉???????翫??????紊???榊??????????????若?鴻???????????с??Shift_JIS ????絖???????篏帥?c????????翫?????????莎激???????醇?с?????若?吟?若??茯?茘??????ャ??????????????????????????障????? ?????c?????????????????違???????篁ヤ????????????????????????????眼???????鴻?????????с??????с??????????????

*UTF-8 (UTF-16 ???鐚?) 篁ュ??????潟?潟?若????c?潟?違???絖???????羝<??????????翫??????紊??????榊???????????
*UTF-8 篁ュ??????潟?潟?若????c?潟?違???絖???????羝<??????????翫???????????????? UTF-8 ????????????????????蚊?????
*YAML ??茹?????????с??潟?潟?若????c?潟?違??????????????????????????Shift_JIS ????с??罩c????f????с??????????????????



-- 
http://redmine.ruby-lang.org