Skip to content

Commit

Permalink
quick js doesn't have native utf16 support
Browse files Browse the repository at this point in the history
  • Loading branch information
BlurryLight committed Jan 8, 2024
1 parent 87566c7 commit 56a4e8f
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions unreal/Puerts/Source/JsEnv/Public/V8Utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,11 @@ class FV8Utils

FORCEINLINE static FString ToFString(v8::Isolate* Isolate, v8::Local<v8::Value> Value)
{
#if WITH_QUICKJS
return UTF8_TO_TCHAR(*(v8::String::Utf8Value(Isolate, Value)));
#else
return UTF16_TO_TCHAR(*(v8::String::Value(Isolate, Value)));
#endif
}

FORCEINLINE static FName ToFName(v8::Isolate* Isolate, v8::Local<v8::Value> Value)
Expand Down Expand Up @@ -148,7 +152,11 @@ class FV8Utils

FORCEINLINE static v8::Local<v8::String> ToV8String(v8::Isolate* Isolate, const TCHAR* String)
{
#if WITH_QUICKJS
return v8::String::NewFromUtf8(Isolate, TCHAR_TO_UTF8(String), v8::NewStringType::kNormal).ToLocalChecked();
#else
return v8::String::NewFromTwoByte(Isolate, TCHAR_TO_UTF16(String), v8::NewStringType::kNormal).ToLocalChecked();
#endif
}

FORCEINLINE static v8::Local<v8::String> ToV8String(v8::Isolate* Isolate, const char* String)
Expand Down

0 comments on commit 56a4e8f

Please sign in to comment.