Skip to content
Browse files

pass for most western codepage

  • Loading branch information...
1 parent 454b6ed commit a5183cad2d22046be580ef1b1a6b135a9573bc94 @ryenus committed May 28, 2012
Showing with 15 additions and 3 deletions.
  1. +15 −3 spec/regression/JRUBY-6679_console_codepage.rb
View
18 spec/regression/JRUBY-6679_console_codepage.rb
@@ -4,9 +4,21 @@
describe "JRUBY-6679: Encoding.default_external" do
it "should count in Windows console code page" do
if java.lang.System.getProperty('os.name').include? 'Windows'
- enc_ext = Encoding.default_external.name
- codepage = `cmd /c chcp`.split.last
- enc_ext.include?(codepage).should == true
+ enc_ext = Encoding.default_external
+
+ # unfortunately `cmd /c chcp` doesn't work
+ console = java.lang.System.console
+ fcs = java.io.Console.java_class.declared_field 'cs'
+ fcs.accessible = true
+ cs = fcs.value console
+
+ bl = org.jruby.util.ByteList.create cs.name
+ con_enc = org.jruby.Ruby.globalRuntime.encodingService.loadEncoding bl
+
+ if enc_ext.to_s != 'UTF-8'
+ enc_ext.to_s.should == con_enc.to_s
+ #enc_ext.should == con_enc
+ end
end
end
end

0 comments on commit a5183ca

Please sign in to comment.
Something went wrong with that request. Please try again.