github-contents icon indicating copy to clipboard operation
github-contents copied to clipboard

More ergonomic handing of Unicode strings

Open simonw opened this issue 6 years ago • 3 comments

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

simonw avatar Jun 09 '19 21:06 simonw

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

simonw avatar Jun 09 '19 21:06 simonw

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

simonw avatar Jun 09 '19 21:06 simonw

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

https://github.com/simonw/github-contents/blob/a125e533a9125be0b4b395b664407e446b3b23ae/github_contents.py#L102-L109

simonw avatar Jun 09 '19 22:06 simonw