Details

    • Number of attachments :
      1

      Description

      Running the following code:

      f = File.new("/tmp/f")
      io = f.to_io
      e = Encoding.find("ASCII-8BIT")
      io.internal_encoding
      io.external_encoding
      io.set_encoding(e)
      puts io.external_encoding
      

      Gives back the output of:

      => #<Encoding:UTF-8>

      Instead of:

      => #<Encoding:ASCII-8BIT>

      I did notice that the work around of instead doing:

      io.set_encoding("ASCII-8BIT")

      Worked as expected.

        Activity

        Hide
        Charles Oliver Nutter added a comment -

        Nice softball bug Looking into it.

        Show
        Charles Oliver Nutter added a comment - Nice softball bug Looking into it.
        Hide
        Charles Oliver Nutter added a comment -

        It looks like it's setting internal instead of external. Testing a fix.

        Show
        Charles Oliver Nutter added a comment - It looks like it's setting internal instead of external. Testing a fix.
        Hide
        Charles Oliver Nutter added a comment -

        commit 1b3665d0fcd87d6b421ea9ccba540075262f463f
        Author: Charles Oliver Nutter <headius@headius.com>
        Date: Tue Aug 21 14:37:28 2012 -0500

        Fix JRUBY-6851: IO#set_encoding doesn't work with Encoding object

        We were setting internal, not external, for a single enc passed.

        Show
        Charles Oliver Nutter added a comment - commit 1b3665d0fcd87d6b421ea9ccba540075262f463f Author: Charles Oliver Nutter <headius@headius.com> Date: Tue Aug 21 14:37:28 2012 -0500 Fix JRUBY-6851 : IO#set_encoding doesn't work with Encoding object We were setting internal, not external, for a single enc passed.

          People

          • Assignee:
            Charles Oliver Nutter
            Reporter:
            Mark Mandel
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: