On Tue, Jun 08, 2021 at 07:45:22PM +0200, Mattias Engdegård wrote: > 8 juni 2021 kl. 14.14 skrev Lars Ingebrigtsen : > > >> It's always possible that stringWithLispString isn't doing the right > >> thing. It's implemented at nsfns.m:3026. I know almost nothing about > >> UTF8/UTF16 so while it looks like it's doing the right thing to me, I > >> could be entirely wrong. > > > > Right -- and that was written by Mattias, so I've added him to the CCs. > > Thank you, but stringWithLispString: is actually fine, unless you > count its inability to produce useful results from wrong input! In my defence it wasn't entirely clear to me that a lisp string returned from ENCODE_FILE was incompatible with stringWithLispString. ;) > The image code seems to be quite confused with respect to whether > the file names being passed around are in encoded form. Until > recently it seems to have worked by pure chance since as long as the > file name encoding is UTF-8 and the low-level code accesses the raw > string data we do get the same result, but at least since > 747a923b9a35 that's no longer the case. Hmm, and as you point out we use "file" further down and it may or may not be encoded, but will probably have the same contents as found, which we know is encoded. Plus it's setting the "name" field in the image, which we probably want to keep as uniform as possible for caching purposes but is otherwise irrelevant. I think the attached should solve this. -- Alan Third