Skip to content

Commit

Permalink
Fix handling UTF-8 object keys (#6373)
Browse files Browse the repository at this point in the history
<!-- Thanks for submitting a pull request! We appreciate you spending
the time to work on these changes. Please follow the template so that
the reviewers can easily understand what the code changes affect. -->

## Summary

<!-- Explain the motivation for this PR. Include "Fixes #<number>" if
applicable. -->

Regarding this
[issue](#6220)
the PR solves it by creating a jsi key string from utf8.

Fixes #6220.

## Test plan

<!-- Provide a minimal but complete code snippet that can be used to
test out this change along with instructions how to run it and a
description of the expected behavior. -->

Tested on demo provided in issue mentioned above.

---------

Co-authored-by: Tomek Zawadzki <tomekzawadzki98@gmail.com>
  • Loading branch information
coado and tomekzaw committed Aug 5, 2024
1 parent b28f779 commit faaeff3
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ ShareableObject::ShareableObject(
jsi::Value ShareableObject::toJSValue(jsi::Runtime &rt) {
auto obj = jsi::Object(rt);
for (size_t i = 0, size = data_.size(); i < size; i++) {
obj.setProperty(rt, data_[i].first.c_str(), data_[i].second->toJSValue(rt));
obj.setProperty(rt, jsi::String::createFromUtf8(rt, data_[i].first), data_[i].second->toJSValue(rt));
}
#if SUPPORTS_NATIVE_STATE
if (nativeState_ != nullptr) {
Expand Down

0 comments on commit faaeff3

Please sign in to comment.