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

More ergonomic handing of Unicode strings #1

Open
simonw opened this issue Jun 9, 2019 · 3 comments
Open

More ergonomic handing of Unicode strings #1

simonw opened this issue Jun 9, 2019 · 3 comments

Comments

@simonw
Copy link
Owner

simonw commented Jun 9, 2019

It would be nice if you didn't have to manually convert to and from byte strings every time you use this library.

@simonw
Copy link
Owner Author

simonw commented Jun 9, 2019

A .read_text(...) similar to in pathlib would be nice.

@simonw
Copy link
Owner Author

simonw commented Jun 9, 2019

The .write(...) methods could take either bytes or str and encode as utf8 automatically.

@simonw
Copy link
Owner Author

simonw commented Jun 9, 2019

This code here could use utf8 encoding when sending large Unicode strings, avoiding the extra overhead of base64:

created_blob = self.session.post(
self.base_url() + "/git/blobs",
json={
"encoding": "base64",
"content": base64.b64encode(content_bytes).decode("latin1"),
},
headers=self.headers(),
).json()

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

No branches or pull requests

1 participant