GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — src: use UTF-8 for naming interfaces in unix · nodejs/node@2548f75

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • src
    • node_os.cc
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎src/node_os.cc‎

Copy file name to clipboardExpand all lines: src/node_os.cc
+5-7Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -257,15 +257,13 @@ static void GetInterfaceAddresses(const FunctionCallbackInfo<Value>& args) {
257257
for (i = 0; i < count; i++) {
258258
const char* const raw_name = interfaces[i].name;
259259

260-
// On Windows, the interface name is the UTF8-encoded friendly name and may
261-
// contain non-ASCII characters. On UNIX, it's just a binary string with
262-
// no particular encoding but we treat it as a one-byte Latin-1 string.
263-
#ifdef _WIN32
260+
// Use UTF-8 on both Windows and Unixes (While it may be true that UNIX
261+
// systems are somewhat encoding-agnostic here, it’s more than reasonable
262+
// to assume UTF8 as the default as well. It’s what people will expect if
263+
// they name the interface from any input that uses UTF-8, which should be
264+
// the most frequent case by far these days.)
264265
name = String::NewFromUtf8(env->isolate(), raw_name,
265266
v8::NewStringType::kNormal).ToLocalChecked();
266-
#else
267-
name = OneByteString(env->isolate(), raw_name);
268-
#endif
269267

270268
if (ret->Has(env->context(), name).FromJust()) {
271269
ifarr = Local<Array>::Cast(ret->Get(name));

0 commit comments

Comments
0 (0)
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.