Skip to content

Fixes inconsistent encoding behavior. #177

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

Merged
merged 1 commit into from
Mar 5, 2019

Conversation

emmnx
Copy link
Contributor

@emmnx emmnx commented Mar 5, 2019

Python encodes ASCII by default and escapes the unicode characters.
This fix enforces utf-8.

Python 3.5.2 (default, Nov 23 2017, 16:37:01) 
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import ipfsapi
>>> api = ipfsapi.connect('127.0.0.1', 5001)
>>> val = {"key": "Value, não é?"}
>>> api.add_json(val)
'QmNRzhk1e4cHYpqej7LjguBd5fP4uLyVYTQFfJFGm9ESLQ'
>>> api.get_json('QmNRzhk1e4cHYpqej7LjguBd5fP4uLyVYTQFfJFGm9ESLQ')
{'key': 'Value, não é?'}
>>> 

This is ok, expected behavior.

https://ipfs.io/ipfs/QmNRzhk1e4cHYpqej7LjguBd5fP4uLyVYTQFfJFGm9ESLQ <-- Ok here as well.

Python encodes ASCII by default and escapes the unicode characters.
This fix enforces utf-8.
@ntninja ntninja changed the base branch from master to py-ipfs-http-client March 5, 2019 20:28
@ntninja ntninja changed the base branch from py-ipfs-http-client to master March 5, 2019 20:29
@ntninja
Copy link
Contributor

ntninja commented Mar 5, 2019

Thanks for finding this! This really shouldn't be happening. 🙂

@ntninja ntninja merged commit 7574dad into ipfs-shipyard:master Mar 5, 2019
@emmnx emmnx deleted the json-utf8-patch branch March 5, 2019 20:38
@ntninja
Copy link
Contributor

ntninja commented Mar 5, 2019

Was merged as part of #168 for py-ipfs-http-client.

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