-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Playground: Incorrect Handling of Non-Latin1 Characters Causes Encoding Error in Share Functionality #4024
Closed
4 tasks done
Labels
Comments
orange-guo
added
bug
needs triage
Initial label given, to be assigned correct labels and assigned
labels
Jan 5, 2024
@orange-guo Same issue as #3698. We'd appreciate a PR as long as it doesn't break existing playground links! |
nickgros
added
playground
and removed
needs triage
Initial label given, to be assigned correct labels and assigned
labels
Jan 5, 2024
orange-guo
added a commit
to orange-guo/react-jsonschema-form
that referenced
this issue
Jan 9, 2024
… encoding and decoding functions using the utf-8 charset to support the characters outside the latin1 range. (rjsf-team#4024)
orange-guo
added a commit
to orange-guo/react-jsonschema-form
that referenced
this issue
Jan 9, 2024
orange-guo
added a commit
to orange-guo/react-jsonschema-form
that referenced
this issue
Jan 9, 2024
…e new customized base64 in 'utils' (rjsf-team#4024).
orange-guo
added a commit
to orange-guo/react-jsonschema-form
that referenced
this issue
Jan 9, 2024
orange-guo
added a commit
to orange-guo/react-jsonschema-form
that referenced
this issue
Jan 9, 2024
orange-guo
added a commit
to orange-guo/react-jsonschema-form
that referenced
this issue
Jan 9, 2024
orange-guo
added a commit
to orange-guo/react-jsonschema-form
that referenced
this issue
Jan 9, 2024
orange-guo
added a commit
to orange-guo/react-jsonschema-form
that referenced
this issue
Jan 11, 2024
orange-guo
added a commit
to orange-guo/react-jsonschema-form
that referenced
this issue
Jan 11, 2024
orange-guo
added a commit
to orange-guo/react-jsonschema-form
that referenced
this issue
Jan 17, 2024
# Conflicts: # CHANGELOG.md
heath-freenome
pushed a commit
that referenced
this issue
Jan 18, 2024
…charset to support the characters outside the latin1 range. (#4024) (#4034) * Enhancement(Share): Declare and export an object that provides base64 encoding and decoding functions using the utf-8 charset to support the characters outside the latin1 range. (#4024) * Enhancement(Share): Add the 'base64.test.ts' to test the base64. (#4024) * Enhancement(Share): Update the base64 reference in 'Playground' to the new customized base64 in 'utils' (#4024). * Enhancement(Share): Update 'CHANGELOG.md' (#4024). * Enhancement(Share): Update 'CHANGELOG.md' (#4024). * Enhancement(Share): Add test to test the platform behavior (#4024). * Enhancement: Fix comments and updating utility-functions.md to add introduction of base64 object * Update CHANGELOG.md * Update CHANGELOG.md * Update base64.ts
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Prerequisites
What theme are you using?
core
Version
5.x
Current Behavior
No response
Expected Behavior
No error occurred.
Steps To Reproduce
In the playground, paste the following JSON into the JSONSchema editor:
After clicking the Share button, the Chrome console displays the following error:
This error occurs in the Chrome console due to the attempted base64 encoding using 'btoa', which fails when encountering characters outside the Latin1 range, such as those in the Chinese language.
This issue arises because 'btoa' is limited to encoding Latin1 characters and cannot handle characters from non-Latin1 languages, resulting in the displayed error message.
Environment
Anything else?
To enhance the sharing functionality in the playground, it's recommended to switch the text encoding from Latin1 to UTF-8. This change will expand character support, enabling encoding for a broader range of characters, including Asian languages like Chinese and Japanese, by utilizing the UTF-8 encoding standard.
To facilitate this modification, adjustments are required in two sections: the load method within Playground.tsx and the implementation of the share button in onShare within Header.tsx.
Replace references to atob and btoa with the following functions:
If needed, I can submit a PR later to enhance this functionality.
The text was updated successfully, but these errors were encountered: