You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Passing Chévere as a string param in Native throws with: panicked at \'called Result::unwrap()on anErr value: Custom { kind: InvalidData, error: "invalid utf-8 sequence of 1 bytes from index 2" }\'
In Anchor the same string works fine.
To Reproduce
Anchor test, works fine:
Native test, fails:
Expected behavior
To allow any utf-8 char in a string in native.
Platform version:
CLI Version [e.g. v0.1.0]
GenService Version v0.8
Extension (mark with an X the extension):
Solana Native [x]
Solana Anchor [ ]
The text was updated successfully, but these errors were encountered:
After further research, the issue is originated in a bug in the borsh-js 1.0.0 library, which serializes a non ascii char in one single byte instead of following utf-8.
To solve this issue, we need to change the current library.
Anchor uses borsh-js 0.7.0
Another library that has been tested on works fine is borsh-ts 5.1.8
Both libraries have been tested and work fine.
Because both solutions have different serdes syntax code than borsh 1.0.0, this fix will require to change client code generation, and probably the ts-config.ts generated file (both make use of ts classes to define the schema)
@julianzamtborsh-js developer here, indeed this is a bug from our library, will see to get the patch expedited, please check if this solves the problem on your side: near/borsh-js#76
Describe the bug
Passing
Chévere
as a string param in Native throws with:panicked at \'called
Result::unwrap()on an
Errvalue: Custom { kind: InvalidData, error: "invalid utf-8 sequence of 1 bytes from index 2" }\'
In Anchor the same string works fine.
To Reproduce
Anchor test, works fine:
Native test, fails:
Expected behavior
To allow any utf-8 char in a string in native.
Platform version:
Extension (mark with an X the extension):
The text was updated successfully, but these errors were encountered: