👥 feat[idempotent-quoting]: Add idempotent quoting - #13
Conversation
|
@pacman82 @xhochy @matthias-bach-by |
Sure. Technically it is sound. The benchmarks would not even have been necessary. The specification you are going against I have some questions though. What exactly is the problem you are solving? Why can you not be idempotent by remembering the original input? There are other encodings already which also do not use The Best, Markus |
|
Hi @pacman82, Existing quoting methods are too restrictive for this use case—they’re designed for specific input forms, whereas this approach needs to handle arbitrary quote-checking. Let me know if anything’s still unclear. Regards, |
|
Okay, I'll approve. Yet please take out the benchmarks. We can vet them in a separate PR. Best, Markus |
ac16de2 to
2f8a847
Compare
|
Hey @pacman82, thanks. Removed the benchmarks for now. Regards, |
f4841d1 to
6ffeeca
Compare
|
@DJ73 , Thanks for the contribution. |
|
@pacman82, just one more point, could you create a release for it as well please? The build has not been published |
Currently, the Python 3.7 quoting implementation encodes the % character as %25, which causes repeated quoting on already-quoted strings to produce different outputs on each pass. This leads to inconsistent and non-idempotent behavior when the quoting function is applied multiple times to strings with unknown quoting levels.
This change introduces an option to use an idempotent quoting mode that preserves existing percent-encodings and ensures that multiple iterations of quoting produce the same output. This guarantees stability and predictability for quoting operations, preventing double-encoding issues in downstream processing.