Sha256: 65c0a128f26154b1a438cb76078425a551d46fbb471f4d799c769721d37df5dd

Contents?: true

Size: 1.03 KB

Versions: 4

Compression:

Stored size: 1.03 KB

Contents

# Require this file if you need Unicode support.
require 'cucumber/platform'
require 'cucumber/formatter/ansicolor'
$KCODE='u' unless Cucumber::RUBY_1_9

if Cucumber::WINDOWS && `cmd /c chcp` =~ /(\d+)/
  require 'iconv'
  codepage = $1.to_i
  Cucumber::CODEPAGE = "cp#{codepage}"

  module Cucumber
    module WindowsOutput #:nodoc:
      def self.extended(o)
        o.instance_eval do
          alias cucumber_print print
          def print(*a)
            begin
              cucumber_print(*Iconv.iconv(Cucumber::CODEPAGE, "UTF-8", *a.map{|a|a.to_s}))
            rescue Iconv::IllegalSequence
              cucumber_print(*a)
            end
          end

          alias cucumber_puts puts
          def puts(*a)
            begin
              cucumber_puts(*Iconv.iconv(Cucumber::CODEPAGE, "UTF-8", *a.map{|a|a.to_s}))
            rescue Iconv::IllegalSequence
              cucumber_puts(*a)
            end
          end
        end
      end

      Kernel.extend(self)
      STDOUT.extend(self)
      STDERR.extend(self)
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
cucumber-0.5.3 lib/cucumber/formatter/unicode.rb
cucumber-0.5.2 lib/cucumber/formatter/unicode.rb
cucumber-0.5.1 lib/cucumber/formatter/unicode.rb
cucumber-0.5.0 lib/cucumber/formatter/unicode.rb