tool_getparam: output warning for leading unicode quote character

... in the option argument.

Typically this is a mistake done when copying example command lines from
online documentation using the wrong quote character.

Presumably there are also other potential quote characters that might be
used, and this check is done without even knowing that unicode is used!

Reported-by: Sanjay Pujare
Fixes #13214
Closes #13215
This commit is contained in:
Daniel Stenberg 2024-03-30 22:49:01 +01:00
parent aba8043075
commit 94db8e5c27
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2

View File

@ -1337,6 +1337,11 @@ ParameterError getparameter(const char *flag, /* f or -long-flag */
warnf(global, "The file name argument '%s' looks like a flag.",
nextarg);
}
else if(!strncmp("\xe2\x80\x9c", nextarg, 3)) {
warnf(global, "The argument '%s' starts with a unicode quote where "
"maybe an ASCII \" was intended?",
nextarg);
}
}
else if((a->desc == ARG_NONE) && !toggle) {
err = PARAM_NO_PREFIX;