Skip to content
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

fix(weavedrive): store headers as utf8 encoded #396

Merged
merged 1 commit into from
Nov 6, 2024

Conversation

jfrain99
Copy link
Contributor

@jfrain99 jfrain99 commented Nov 6, 2024

Weavedrive pulling data with Chinese characters is was resulting in special characters:

Desired: 
... { name: 'Description', value: 'Smartweave是不是要转到AO了?本文档介绍原子资产SmartWeave合约的标准接口。原子资产是SmartWeave合约及其在发布到Arweave的同一事务中初始化的数据。SmartWeave合约和数据共享一个交易ID。' } ...
Actual:
... {"name":"Description","value":"Smartweave/�-��pnSmartWeav��pnq�*�ID"} ...

If tried to decode using JSON.decode, get the following error:

[string ".handlers"]:559: [string "json"]:261: control character in string at line 1 col 2531

The issue is in the encoding: When saving to the emscripten file system, the files are not automatically encoded as utf-8 (the preferred encoding for Chinese characters). Now, we will encode the data manually.

@jfrain99 jfrain99 requested a review from twilson63 November 6, 2024 20:00
Copy link
Collaborator

@twilson63 twilson63 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jfrain99 jfrain99 merged commit 5b17f76 into main Nov 6, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants