Subject: Re: bug#31376: 26.0.50; print-charset-text-property not honored

From: Eli Zaretskii <[email-masked]>
Date: Sun, 13 May 2018 21:51:18 +0300

> From: Noam Postavsky <[email-masked]>
> Cc: [email-masked],  [email-masked],  [email-masked],  [email-masked]
> Date: Sun, 13 May 2018 14:29:58 -0400
> 
> >   If the value is @code{default}, print only those @code{charset} text
> >   properties that are ``unusual'' for the respective characters under
> >   the current language environment.  The @code{charset} property of a
> >   character is considered unusual if its value is different from what
> >   @code{char-charset} returns for that character.
> 
> Okay, when writing up some tests I may have found another minor bug, or
> at least something which contradicts the text above.  Is there supposed
> to be an exception for ascii characters?

Yes, you can see that in print_check_string_charset_prop:

      charset = XCAR (XCDR (val));
      for (i = 0; i < LENGTH (interval); i++)
	{
	  FETCH_STRING_CHAR_ADVANCE (c, string, charpos, bytepos);
	  if (! ASCII_CHAR_P (c)  <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
	      && ! EQ (CHARSET_NAME (CHAR_CHARSET (c)), charset))
	    {
	      print_check_string_result |= PRINT_STRING_UNSAFE_CHARSET_FOUND;
	      break;
	    }
	}

CHAR_CHARSET always returns 'ascii' for ASCII characters, while
showing 'charset' for ASCII characters probably makes littles sense.
Of course, that's only my guess, the default behavior wrt this is pure
heuristics, so YMMV.

We could mention this exception in the manual.