Skip to content

os.hostname() return garbled code on windows if the host name contains non ascii characters #38255

Closed

Description

@eagleliang
  • 12.14.0 -- latest version:
  • Window 10:
  • Subsystem:

What steps will reproduce the bug?

  1. windows 7/8/10
  2. set pc's name to ANDREW-ü-LAPTOP
  3. make sure 'Use unicode UTF-8 support' is not enable in windows language setting
  4. in node CLI, invoke os.hostname(), it returns ANDREW-�-LAPTOP

How often does it reproduce? Is there a required condition?

Always happen.

What is the expected behavior?

ANDREW-ü-LAPTOP

What do you see instead?

ANDREW-�-LAPTOP

Additional information

the fix of #27848 would work fine on linux/macOs. But on windows, libuv's implement does not decoding the string which return be windows API, which cause this bug.

Activity

  1. eagleliang commented on Apr 16, 2021

    @eagleliang
    Author

    @addaleax @cjihrig I have fixed this locally and want to Push request. But I'm not sure about the stratagy of this PR, since the root cause is in deps/uv/src/win/util.c.

    Should I push this to libuv/libuv first. And then merge the files back to deps/uv after the PR merged in libuv/libuv ?

  2. RaisinTen commented on Apr 16, 2021

    @RaisinTen
    Member

    Yes, you may make a PR at libuv with your change and once that lands, the code in Node.js too will be updated with your change when deps/uv is upgraded with a new release.

  3. added
    libuv
    windows
    on Apr 16, 2021
  4. eagleliang commented on May 14, 2021

    @eagleliang
    Author

    @Ayase-252 Can I make a PR to update deps/uv from libuv as the my PR already be merged in it.
    Because our project awaiting this update in nodejs

  5. Ayase-252 commented on May 14, 2021

    @Ayase-252
    Member

    @eagleliang

    Node.js will update libuv dep when libuv releases a new version in normal workflow. I'm not sure how to handle this case if the patch is urge for you.

    cc @cjihrig

  6. cjihrig commented on May 14, 2021

    @cjihrig
    Contributor

    Yes, we should wait for a new libuv release.

  7. added
    confirmed-bug
    on May 14, 2021
  8. Ayase-252 commented on Nov 18, 2021

    @Ayase-252
    Member

    We have updated libuv to v1.42.0 in #39525.

    It should be resolved now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    confirmed-buglibuvwindows

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions