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

UTF-8 encoding/decoding behavior is confusing #20

Open
oschwald opened this issue Jun 24, 2022 · 1 comment
Open

UTF-8 encoding/decoding behavior is confusing #20

oschwald opened this issue Jun 24, 2022 · 1 comment

Comments

@oschwald
Copy link

oschwald commented Jun 24, 2022

For JSON::PP, Cpanel::JSON::XS, and other similar modules, the decode method takes a binary string and the encode method produces a binary string when the utf8 flag is set on the object and a character string otherwise. For TOML::Tiny, this appears to be the current behavior:

Normal mode:

  • encode - produces a character string
  • decode - takes a character string

Strict mode:

  • encode - produces a character string
  • decode - takes a binary string

The difference in behavior for decode in strict mode appears to be due to this line.

My preference would be that TOML::Tiny takes a flag that controls the UTF-8 encoding/decoding, but at the very least this module should be internally consistent and document the behavior.

@532910
Copy link

532910 commented Nov 21, 2023

I agree with @oschwald: behavior must be consistent.

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

2 participants