parse-options: report uncorrupted multi-byte options
[git.git] / parse-options.c
index c1c66bd408c50685c06fe7ff1e1c6a78c26be1b1..052bf72bb88963cf81bb2303c0ab2354a2125617 100644 (file)
@@ -470,8 +470,11 @@ int parse_options(int argc, const char **argv, const char *prefix,
        default: /* PARSE_OPT_UNKNOWN */
                if (ctx.argv[0][1] == '-') {
                        error("unknown option `%s'", ctx.argv[0] + 2);
-               } else {
+               } else if (isascii(*ctx.opt)) {
                        error("unknown switch `%c'", *ctx.opt);
+               } else {
+                       error("unknown non-ascii option in string: `%s'",
+                             ctx.argv[0]);
                }
                usage_with_options(usagestr, options);
        }