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 b4677f7

Browse filesBrowse files
cola119danielleadams
authored andcommitted
src: fix to use replacement character
PR-URL: #43999 Fixes: #43962 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com> Reviewed-By: Darshan Sen <raisinten@gmail.com> Reviewed-By: LiviaMedeiros <livia@cirno.name> Reviewed-By: Feng Yu <F3n67u@outlook.com>
1 parent 1196023 commit b4677f7
Copy full SHA for b4677f7

File tree

Expand file treeCollapse file tree

2 files changed

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

2 files changed

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

‎src/node_i18n.cc‎

Copy file name to clipboardExpand all lines: src/node_i18n.cc
+5-1Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,11 @@ void ConverterObject::Create(const FunctionCallbackInfo<Value>& args) {
425425
nullptr, nullptr, nullptr, &status);
426426
}
427427

428-
new ConverterObject(env, obj, conv, flags);
428+
auto converter = new ConverterObject(env, obj, conv, flags);
429+
size_t sublen = ucnv_getMinCharSize(conv);
430+
std::string sub(sublen, '?');
431+
converter->set_subst_chars(sub.c_str());
432+
429433
args.GetReturnValue().Set(obj);
430434
}
431435

Collapse file

‎test/parallel/test-whatwg-encoding-custom-textdecoder.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-whatwg-encoding-custom-textdecoder.js
+7Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,3 +199,10 @@ if (common.hasIntl) {
199199
const str = decoder.decode(chunk);
200200
assert.strictEqual(str, 'foo\ufffd');
201201
}
202+
203+
if (common.hasIntl) {
204+
const decoder = new TextDecoder('Shift_JIS');
205+
const chunk = new Uint8Array([-1]);
206+
const str = decoder.decode(chunk);
207+
assert.strictEqual(str, '\ufffd');
208+
}

0 commit comments

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