Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit df1f049

Browse filesBrowse files
joyeecheungmarco-ippolito
authored andcommitted
src: decode native error messages as UTF-8
The native error messages can sometimes contain e.g. path content that are typically passed in as chars with UTF8-encoded code points. The native error throwing code previously always decode the chars as Latin-1, which would be incorrect. PR-URL: #55024 Reviewed-By: Chengzhong Wu <legendecas@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 7802170 commit df1f049
Copy full SHA for df1f049

File tree

Expand file treeCollapse file tree

1 file changed

+5
-1
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+5
-1
lines changed
Open diff view settings
Collapse file

‎src/node_errors.h‎

Copy file name to clipboardExpand all lines: src/node_errors.h
+5-1Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,11 @@ void OOMErrorHandler(const char* location, const v8::OOMDetails& details);
112112
std::string message = SPrintF(format, std::forward<Args>(args)...); \
113113
v8::Local<v8::String> js_code = OneByteString(isolate, #code); \
114114
v8::Local<v8::String> js_msg = \
115-
OneByteString(isolate, message.c_str(), message.length()); \
115+
v8::String::NewFromUtf8(isolate, \
116+
message.c_str(), \
117+
v8::NewStringType::kNormal, \
118+
message.length()) \
119+
.ToLocalChecked(); \
116120
v8::Local<v8::Object> e = v8::Exception::type(js_msg) \
117121
->ToObject(isolate->GetCurrentContext()) \
118122
.ToLocalChecked(); \

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.