JRuby (please use github issues at http://bugs.jruby.org)
  1. JRuby (please use github issues at http://bugs.jruby.org)
  2. JRUBY-6598

to_yaml has garbled text if object contains Chinese or Japanese characters

    Details

    • Type: Bug Bug
    • Status: Resolved Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: JRuby 1.6.7
    • Fix Version/s: JRuby 1.7.0.pre1
    • Component/s: None
    • Labels:
      None
    • Number of attachments :
      0

      Description

      When I try to print obj.to_yaml, it shows garbled text if object contains Chinese or Japanese characters.

      I am using JRuby 1.6.7 on Windows 7, print YAML::ENGINE.yamler shows "psych"

        Activity

        Hide
        David Huang added a comment -

        btw i use --1.9 mode

        Show
        David Huang added a comment - btw i use --1.9 mode
        Hide
        Charles Oliver Nutter added a comment -

        It appears to be fixed on master, but it is indeed broken in 1.6.7. If you can reproduce on master, feel free to reopen. JRuby 1.7 will be released (in preview form) in about a month.

        system ~/projects/jruby $ cat blah.txt
        # encoding: utf-8
        require 'yaml'
        str = '你好'
        p str.to_yaml
        
        system ~/projects/jruby $ jruby blah.txt
        "--- 你好\n...\n"
        
        system ~/projects/jruby $ jruby -ryaml -e "p '你好'.to_yaml"
        "--- 你好\n...\n"
        
        system ~/projects/jruby $ rvm jruby-1.6.7 do ruby --1.9 -ryaml -e "p '你好'.to_yaml"
        "--- \u00E4\u00BD\u00A0\u00E5\u00A5\u00BD\n...\n"
        
        system ~/projects/jruby $ rvm jruby-1.6.7 do ruby --1.9 -ryaml blah.txt
        "--- \u00E4\u00BD\u00A0\u00E5\u00A5\u00BD\n...\n"
        
        Show
        Charles Oliver Nutter added a comment - It appears to be fixed on master, but it is indeed broken in 1.6.7. If you can reproduce on master, feel free to reopen. JRuby 1.7 will be released (in preview form) in about a month. system ~/projects/jruby $ cat blah.txt # encoding: utf-8 require 'yaml' str = '你好' p str.to_yaml system ~/projects/jruby $ jruby blah.txt "--- 你好\n...\n" system ~/projects/jruby $ jruby -ryaml -e "p '你好'.to_yaml" "--- 你好\n...\n" system ~/projects/jruby $ rvm jruby-1.6.7 do ruby --1.9 -ryaml -e "p '你好'.to_yaml" "--- \u00E4\u00BD\u00A0\u00E5\u00A5\u00BD\n...\n" system ~/projects/jruby $ rvm jruby-1.6.7 do ruby --1.9 -ryaml blah.txt "--- \u00E4\u00BD\u00A0\u00E5\u00A5\u00BD\n...\n"

          People

          • Assignee:
            Charles Oliver Nutter
            Reporter:
            David Huang
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: