printf %#H: tweak writing unreserved chars (re: 8477d2ce)

src/cmd/ksh93/bltins/print.c:
- If in UTF-8 locale, only bother to check for unreserved char if
  the character is ASCII (< 128), and write unreserved chars with
  a simple stakputc().
This commit is contained in:
Martijn Dekker 2020-08-13 04:48:44 +01:00
parent a116022625
commit cadd1a81dc
1 changed files with 2 additions and 2 deletions

View File

@ -516,8 +516,8 @@ static char *fmthtml(const char *string, int flags)
{
if(c < 0)
stakputs("%3F");
else if(c <= 255 && strchr(URI_RFC3986_UNRESERVED, c))
stakwrite(op, cp-op);
else if(c < 128 && strchr(URI_RFC3986_UNRESERVED, c))
stakputc(c);
else
while(c = *(unsigned char*)op++, op <= cp)
sfprintf(stkstd, "%%%02X", c);