| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 6b6a26b commit 2548f75
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -257,15 +257,13 @@ static void GetInterfaceAddresses(const FunctionCallbackInfo<Value>& args) { | |||
| 257 | 257 | for (i = 0; i < count; i++) { | |
| 258 | 258 | const char* const raw_name = interfaces[i].name; | |
| 259 | 259 | ||
| 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.) | ||
| 264 | 265 | name = String::NewFromUtf8(env->isolate(), raw_name, | |
| 265 | 266 | v8::NewStringType::kNormal).ToLocalChecked(); | |
| 266 | - #else | ||
| 267 | - name = OneByteString(env->isolate(), raw_name); | ||
| 268 | - #endif | ||
| 269 | 267 | ||
| 270 | 268 | if (ret->Has(env->context(), name).FromJust()) { | |
| 271 | 269 | ifarr = Local<Array>::Cast(ret->Get(name)); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments