mirror of
https://github.com/Tencent/Hippy.git
synced 2026-10-29 14:10:47 +08:00
fix(iOS): jsi convert Chinese string error
This commit is contained in:
@@ -81,7 +81,7 @@ HIPPY_EXPORT_TURBO_METHOD(nativeWithPromise:(nullable id)params
|
||||
if (self = [super init]) {
|
||||
self.enableVideo = YES;
|
||||
self.videoInfo = @{@"a": @"1"};
|
||||
self.strInfo = @"It is a default string!";
|
||||
self.strInfo = @"测试一下,It is a default string!";
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
@@ -155,7 +155,9 @@ static std::shared_ptr<napi::CtxValue> convertObjcObjectToCtxValue(const std::sh
|
||||
std::shared_ptr<napi::CtxValue> result;
|
||||
|
||||
if ([objcObject isKindOfClass:[NSString class]]) {
|
||||
result = context->CreateString([((NSString *)objcObject) UTF8String]);
|
||||
std::string str = [((NSString *)objcObject) UTF8String];
|
||||
unicode_string_view str_view(StringViewUtils::ToU8Pointer(str.c_str()));
|
||||
result = context->CreateString(str_view);
|
||||
} else if ([objcObject isKindOfClass:[NSNumber class]]) {
|
||||
if ([objcObject isKindOfClass:[@YES class]]) {
|
||||
result = context->CreateBoolean(((NSNumber *)objcObject).boolValue);
|
||||
|
||||
Reference in New Issue
Block a user