return err;
}
+/* detect e2 80 80 - e2 80 ff */
+static bool has_leading_unicode(const unsigned char *arg)
+{
+ return ((arg[0] == 0xe2) && (arg[1] == 0x80) && (arg[2] & 0x80));
+}
+
/* the longest command line option, excluding the leading -- */
#define MAX_OPTION_LEN 26
warnf("The filename argument '%s' looks like a flag.",
nextarg);
}
- else if(!strncmp("\xe2\x80\x9c", nextarg, 3)) {
- warnf("The argument '%s' starts with a Unicode quote where "
- "maybe an ASCII \" was intended?",
- nextarg);
+ else if(has_leading_unicode((const unsigned char *)nextarg)) {
+ warnf("The argument '%s' starts with a Unicode character. "
+ "Maybe ASCII was intended?", nextarg);
}
/* ARG_FILE | ARG_STRG */
err = opt_filestring(config, a, nextarg);
# Verify data after the test has been "shot"
<verify>
<stderr>
-%hex[Warning: The argument '%e2%80%9chost:' starts with a Unicode quote where maybe an ]hex%
-Warning: ASCII " was intended?
+%hex[Warning: The argument '%e2%80%9chost:' starts with a Unicode character. Maybe ASCII ]hex%
+Warning: was intended?
</stderr>
</verify>
</testcase>
# Verify data after the test has been "shot"
<verify>
<stderr mode="text">
-%hex[Warning: The argument '%e2%80%9chost:fake%e2%80%9d' starts with a Unicode quote where ]hex%
-Warning: maybe an ASCII " was intended?
+%hex[Warning: The argument '%e2%80%9chost:fake%e2%80%9d' starts with a Unicode character. Maybe ]hex%
+Warning: ASCII was intended?
</stderr>
</verify>
</testcase>