Subject: bug#48902: 28.0.50; Directory names containing apostrophes and backticks cause problems

From: Mattias Engdegård <[email-masked]>
Date: Tue, 8 Jun 2021 20:17:57 +0200

[Replying to a couple of previous messages]

> I guess we just need to make a note that stringWithLispString cannot
> handle UTF-8 encoded filenames, unless someone has a smarter solution.

This is not restricted to file names but yes, we should definitely clarify that it expects Unicode (or ASCII) strings as input, since raw bytes are interpreted as, well, raw bytes.

> NSString can read in almost anything, and Mattias extended it to read
> in multibyte (and ascii) lisp strings, so we don't need a UTF-16 input
> specifically. It would probably be nice if NSString was also able to
> recognise that a lisp string is UTF-8 and handle that itself, but I
> don't think that's really possible, unless we make the assumption that
> any unibyte string it's passed will already be ascii or UTF-8.
> 
> I don't know if that's a reasonable assumption.

No, I don't think it's reasonable either -- we should not put dwimmery into our string conversion logic just because we are too sloppy to document whether an argument or return value is encoded or not. stringWithLispString: appears to work as designed.