Skip to content

Socket.gethostname ignores encoding settings #2558

@jsvd

Description

@jsvd

tested on windows but also happens on macosx. I can't make Socket.gethostname return a UTF-8 string even when fiddling with Encoding.default_internal and external settings.

Example:

C:\Users\Jsvd>irb
io/console not supported; tty will not be manipulated
irb(main):001:0>  puts ''.encoding; require 'socket'; puts Socket.gethostname.encoding
Windows-1252
Windows-1252
=> nil
irb(main):002:0>

C:\Users\Jsvd>irb -EUTF-8
io/console not supported; tty will not be manipulated
irb(main):001:0> puts ''.encoding; require 'socket'; puts Socket.gethostname.encoding
UTF-8
Windows-1252
=> nil
irb(main):002:0>

C:\Users\Jsvd>jruby -v
jruby 1.7.17 (1.9.3p392) 2014-12-09 fafd1a7 on Java HotSpot(TM) 64-Bit Server VM 1.8.0_31-b13 +jit [Windows 7-amd64]

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions