-
Notifications
You must be signed in to change notification settings - Fork 717
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[unreal]v8 和 UE 字符串传递默认使用 UTF16 避免编码转换 (#1628)
* v8 <-> UE use UTF16-LE by default * clang-format remove empty space * quick js doesn't have native utf16 support * 实现不能放到Public 头文件 V8Utils.h里 * export symbols because FV8Utils is no more header only
- Loading branch information
1 parent
3cab273
commit 1b4768d
Showing
2 changed files
with
23 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#include <V8Utils.h> | ||
|
||
v8::Local<v8::String> puerts::FV8Utils::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 | ||
} | ||
|
||
FString puerts::FV8Utils::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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters