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

How do you represent bencoded strings that contain a <hex> tag to avoid ambiguity? #3

Closed
josecelano opened this issue Nov 1, 2024 · 1 comment

Comments

@josecelano
Copy link

josecelano commented Nov 1, 2024

Relates to: torrust/bencode2json#7

I implemented a port of the format <hex>...</hex> use in this repo to Rust:

torrust/bencode2json#7

And someone told me it's not reversible. I had not realized.

It's just to warn other people using this format. Maybe we can come up with an alternative. I think this is the only repo I've seen using this format.

@Chocobo1
Copy link
Owner

Chocobo1 commented Nov 4, 2024

How do you represent bencoded strings that contain a tag to avoid ambiguity?

I don't. I rely on the probability that hitting this edge case is very low for my application. Even if encountered, I can just shrug and say too bad, this isn't supported.

This special representation (<hex></hex>) is not so useful for a library author and I don't think it is able to improve it. The best you can do is (probably) try to convert to string and fallback to raw bytes when failed.

@Chocobo1 Chocobo1 closed this as not planned Won't fix, can't repro, duplicate, stale Nov 4, 2024
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