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

[CBOR] allow opting out of hex autodetection #2

Open
plexus opened this issue Jun 29, 2023 · 1 comment
Open

[CBOR] allow opting out of hex autodetection #2

plexus opened this issue Jun 29, 2023 · 1 comment

Comments

@plexus
Copy link

plexus commented Jun 29, 2023

The current design assumes that any string that is valid hex is intended to a binary string. This means it's not possible to encode such strings as regular strings, e.g. "1234".

Would it be possible to make this behavior optional? opt-in ideally, or opt-out.

Thanks.

@Titan-C
Copy link
Owner

Titan-C commented Jun 29, 2023

That is an early design choice as the most useful to my circumstances. Yes I have been bitten by that choice a few times, unlikely scenarios are more common in practice.
Unfortunately(to my knowledge) there is no good typing in emacs to separate a unibytestring and multibyte one. I have sometimes suffered from a string changing between the two during normal use.

I once tried having the byte-string wrapped in a struct. But that complicates the minimal design of this package and to my case, it didn't help much. In the end hex-string and normal string can equally hold information, and that is good enough for me. And if I really need it to be a string some white space padding does the trick for me, way better than anything else.

Of course, feel free to fork the project and give it a try yourself. If I like your approach, I might steal it back into the project. That is the rule of GPLv3.

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