{"action":"created","issue":{"url":"https://api.github.com/repos/jruby/jruby/issues/3871","repository_url":"https://api.github.com/repos/jruby/jruby","labels_url":"https://api.github.com/repos/jruby/jruby/issues/3871/labels{/name}","comments_url":"https://api.github.com/repos/jruby/jruby/issues/3871/comments","events_url":"https://api.github.com/repos/jruby/jruby/issues/3871/events","html_url":"https://github.com/jruby/jruby/issues/3871","id":154102999,"number":3871,"title":"Encoding.find(\"filesystem\") on windows","user":{"login":"ahorek","id":9540855,"avatar_url":"https://avatars.githubusercontent.com/u/9540855?v=3","gravatar_id":"","url":"https://api.github.com/users/ahorek","html_url":"https://github.com/ahorek","followers_url":"https://api.github.com/users/ahorek/followers","following_url":"https://api.github.com/users/ahorek/following{/other_user}","gists_url":"https://api.github.com/users/ahorek/gists{/gist_id}","starred_url":"https://api.github.com/users/ahorek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ahorek/subscriptions","organizations_url":"https://api.github.com/users/ahorek/orgs","repos_url":"https://api.github.com/users/ahorek/repos","events_url":"https://api.github.com/users/ahorek/events{/privacy}","received_events_url":"https://api.github.com/users/ahorek/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-05-10T20:47:26Z","updated_at":"2016-05-10T21:02:18Z","closed_at":null,"body":"<!--\r\nThis is a simple template for filing JRuby isuses.\r\n\r\nPlease help us help you by providing the information below.\r\n\r\nText inside XML comment tags will not be shown in your report.\r\n-->\r\n\r\n### Environment\r\n\r\n<!--\r\nProvide at least:\r\n* JRuby version (`jruby -v`) and command line (flags, JRUBY_OPTS, etc)\r\n* Operating system and platform (e.g. `uname -a`)\r\n\r\nOther relevant info you may wish to add:\r\n* Installed or activated gems\r\n* Application/framework version (e.g. Rails, Sinatra)\r\n* Environment variables\r\n-->\r\njruby 9.1.0.0 (2.3.0) 2016-05-02 a633c63 Java HotSpot(TM) 64-Bit Server VM 25.92-b14 on 1.8.0_92-b14 +jit [mswin32-x86_64]\r\n\r\n### Expected Behavior\r\n\r\n<!--\r\nDescribe your expectation of how JRuby should behave.\r\nProvide an executable Ruby script or a link to an example repository.\r\n-->\r\n\r\nmri\r\n```bash\r\nirb(main):007:0> Encoding.find(\"filesystem\")\r\n=> #<Encoding:Windows-1252>\r\nirb(main):008:0> Encoding.default_external\r\n=> #<Encoding:IBM852>\r\n```\r\n\r\n### Actual Behavior\r\n\r\n<!--\r\nDescribe or show the actual behavior.\r\nProvide text or screen capture showing the behavior.\r\n-->\r\n\r\njruby\r\n```bash\r\nirb(main):023:0> Encoding.find(\"filesystem\")\r\n=> #<Encoding:IBM852>\r\nirb(main):024:0> Encoding.default_external\r\n=> #<Encoding:IBM852>\r\n```\r\n\r\nit looks like Encoding.find(\"filesystem\") is just an alias to Encoding.default_external\r\n```ruby\r\n            case FILESYSTEM:\r\n                // This needs to do something different on Windows. See encoding.c,\r\n                // in the enc_set_filesystem_encoding function.\r\n                return runtime.getDefaultExternalEncoding();\r\n```\r\nhttps://github.com/jruby/jruby/blob/master/core/src/main/java/org/jruby/runtime/encoding/EncodingService.java#L545\r\n\r\nfor windows the mri's logic is a little bit different\r\n```c\r\nint Init_enc_set_filesystem_encoding(void)\r\n{\r\n    int idx;\r\n#if defined NO_LOCALE_CHARMAP\r\n# error NO_LOCALE_CHARMAP defined\r\n#elif defined _WIN32 || defined __CYGWIN__\r\n    char cp[SIZEOF_CP_NAME];\r\n    CP_FORMAT(cp, AreFileApisANSI() ? GetACP() : GetOEMCP());\r\n    idx = rb_enc_find_index(cp);\r\n    if (idx < 0) idx = ENCINDEX_ASCII;\r\n#else\r\n    idx = rb_enc_to_index(rb_default_external_encoding());\r\n#endif\r\n    return idx;\r\n}\r\n```"},"comment":{"url":"https://api.github.com/repos/jruby/jruby/issues/comments/218290435","html_url":"https://github.com/jruby/jruby/issues/3871#issuecomment-218290435","issue_url":"https://api.github.com/repos/jruby/jruby/issues/3871","id":218290435,"user":{"login":"headius","id":10135,"avatar_url":"https://avatars.githubusercontent.com/u/10135?v=3","gravatar_id":"","url":"https://api.github.com/users/headius","html_url":"https://github.com/headius","followers_url":"https://api.github.com/users/headius/followers","following_url":"https://api.github.com/users/headius/following{/other_user}","gists_url":"https://api.github.com/users/headius/gists{/gist_id}","starred_url":"https://api.github.com/users/headius/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/headius/subscriptions","organizations_url":"https://api.github.com/users/headius/orgs","repos_url":"https://api.github.com/users/headius/repos","events_url":"https://api.github.com/users/headius/events{/privacy}","received_events_url":"https://api.github.com/users/headius/received_events","type":"User","site_admin":false},"created_at":"2016-05-10T21:02:18Z","updated_at":"2016-05-10T21:02:18Z","body":"We can probably bind these few methods, but we don't have a compile time for it (and I expect `ArgFileApisANSI` is a compiler macro. What does MRI produce for filesystem encoding on your system?\r\n\r\n@ahorek Does the output of `ENV_JAVA['file.encoding']` match what you would expect from the `filesystem` Encoding in Ruby?"}}