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

Encoding correctness #35

Open
AMDmi3 opened this issue Jan 23, 2019 · 2 comments
Open

Encoding correctness #35

AMDmi3 opened this issue Jan 23, 2019 · 2 comments

Comments

@AMDmi3
Copy link
Owner

AMDmi3 commented Jan 23, 2019

Need to be considered more carefully. For now, important thoughts are:

  • text input should probably be disallowed, as it complicates logic, reduces performance and introduces subtle errors
  • yajl_dont_validate_strings could be enabled by default to make parser insensitive to the encoding. For binary output it should pass data as is, for unicode output python encoding would give more informative error messages
@AMDmi3
Copy link
Owner Author

AMDmi3 commented Jan 24, 2019

Apart from this, the following behavior makes sense:

  • binary→binary trivial, no encoding needed. Require binary path as well?
  • binary→unicode decode as open would do, use encoding/errors arguments with sane defaults. Apply same to path.
  • unicode→unicode may just encode to/from utf-8 internally. But better disallow.
  • unicode→binary and this one does not make much sense. Should we try to recover original encoding from file handle and encode into it (encoding is not always available), or should we encode according to arguments? How should we handle path? Very ambiguous.

@AMDmi3
Copy link
Owner Author

AMDmi3 commented Feb 12, 2019

After some thought, we should not disallow unicode input, as there could be a case of e.g. utf-16 input decoded. So in case of any non-binary input, just encode it as utf-8 for YAJL (which it expects internally) and decode normally.

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