mirror of
https://github.com/nodejs/node.git
synced 2026-11-09 15:11:11 -05:00
src,tools: allow utf-8 in built-in js source code
PR-URL: https://github.com/nodejs/node/pull/5418 Reviewed-By: Trevor Norris <trev.norris@gmail.com>
This commit is contained in:
1 parent
581606a5fd
commit
cdc7e025e0
2 files changed
+11
-25
No files matched your search
@@ -13,11 +13,14 @@ namespace node {
|
||||
|
||||
using v8::HandleScope;
|
||||
using v8::Local;
|
||||
using v8::NewStringType;
|
||||
using v8::Object;
|
||||
using v8::String;
|
||||
|
||||
Local<String> MainSource(Environment* env) {
|
||||
return OneByteString(env->isolate(), node_native, sizeof(node_native) - 1);
|
||||
return String::NewFromUtf8(
|
||||
env->isolate(), reinterpret_cast<const char*>(node_native),
|
||||
NewStringType::kNormal, sizeof(node_native) - 1).ToLocalChecked();
|
||||
}
|
||||
|
||||
void DefineJavaScript(Environment* env, Local<Object> target) {
|
||||
@@ -26,10 +29,10 @@ void DefineJavaScript(Environment* env, Local<Object> target) {
|
||||
for (int i = 0; natives[i].name; i++) {
|
||||
if (natives[i].source != node_native) {
|
||||
Local<String> name = String::NewFromUtf8(env->isolate(), natives[i].name);
|
||||
Local<String> source = String::NewFromUtf8(env->isolate(),
|
||||
natives[i].source,
|
||||
String::kNormalString,
|
||||
natives[i].source_len);
|
||||
Local<String> source =
|
||||
String::NewFromUtf8(
|
||||
env->isolate(), reinterpret_cast<const char*>(natives[i].source),
|
||||
NewStringType::kNormal, natives[i].source_len).ToLocalChecked();
|
||||
target->Set(name, source);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user