-
Notifications
You must be signed in to change notification settings - Fork 3
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
Bug: jstrencode(1) man page has incorrect information about -Q #11
Comments
See also GH-issuecomment-2337677465. |
I wonder how this happened. Thanks for bringing it up! The options and the other comments that have to be read I might be too tired to look at right now but at least the documentation one can be easily fixed. |
As for Your bug report made me realise there was a mistake in the bug report template too so I fixed that. |
Sure. However there is already a |
FYI: See GH-issuecomment-2339392055 for a remark on priories. |
We believe we have addressed all of the current questions that still need answering at this time. If we've missed something or something else needs to be clarified, please ask again. |
Yup ... I forgot that. Noted it in another bug report. Decided on |
I believe that the jstrdecode code is fixed (not the decoding bug in I think it was #13 but the Anyway, it would be nice if these two issues can be resolved so that we can focus on the more serious one. |
Thank you and we recommend jparse repo PR 15 as a follow-up. |
Thank you! Merged that a short bit ago. |
That being said I've not finished this issue: the new proposed option was not added yet so I'll reopen this issue to more easily find it. I'm hoping I can look at it more soon. |
Hmm ... with the first comment suggesting that the behaviour of |
Okay I see that actually we have to modify the functions in I hope everything is okay with your family now! Back in a while. |
Reading the option proposal...
Does this mean that with If so what about:
?
At a look with these examples and the example below it appears you've simply swapped the letters. Is that the case or have I missed something?
I'm still unsure how this is meant to work so I will leave it at that and go take care of other things ... including things I did not anticipate. Will explain in the OT thread. |
REPLYA reply to the implied question of GH-issuecomment-2351100502 follows. We are going to go thru a step by step build up of SetupWe will assume that we are working with synced stuff, including:
All of which seem to be synced to the same jparse code as of the time of this comment. We have done a jstrencode and jstedecode testsIn this next example, we are asking how to encode as JSON string, the characters: "foo" $ jstrencode '"foo"'
\"foo\" The backslashed double quotes are expended because the default purpose of With $ jstrencode -Q '"foo"'
foo This is expended because the
and the
FIX NEEDED: change to
|
With PR #16 the man page has been fixed. See GH-issuecomment-2351382556. |
Is there an existing issue for this?
Describe the bug
The
jstrencode(1)
man page says about-Q
:This is incorrect.
What
-Q
does forjstrencode(1)
is that IF the string both starts with and ends with a double quote, (as if it is a JSON string), then those enclosing double quotes MUST be ignored.All of the above is correct behavior for
jstrencode(1)
.What you expect
The
jstrencode(1)
man page indicates that IFF (if and only if) a string starts and ends in double quotes, the enclosing double quotes MUST be ignored.This applies to any string argument. For example here are two strings:
This seems like correct behavior.
Also this seems like correct behavior:
A proposed new option for jstrencode
Although it could be argued that the above 2 examples are incorrect. One could argue that when there are 2 or more arguments, one could first concatenate all arguments and then if the
-Q
option was given, only ignore ignore double-quotes ONLY if they surround the concatenation of the args. We can see both behaviors.NOTE: Perhaps the
jstrencode -Q
should ignore ONLY enclosing double-quotes around the concatenation of all args. If one wanted to remove enclosing double-quotes around EACH argument, use a new option such as-m
:$ jstrencode -h ... -Q ignore double-quotes that surround the concatenation of all strings (def: encode all bytes) -m ignore enclosing double-quotes for each string (def: encode all bytes)
So we would have:
And:
And one could combine both
-Q
and-m
:See GH-issuecomment-2337761412 for how these same 2 options would apply to
jstrdecode(1)
.Environment
bug_report.sh output
n/a
Anything else?
FYI: The usage message for
jstrencode(1)
is correct:$ jstrencode -h ... -Q ignore enclosing "'s (def: encode all bytes)
Although the usage message could be worded better. See the above "proposal for a new option" for some better wording.
You might wish to use that language in the
jstrencode(1)
man page.The text was updated successfully, but these errors were encountered: