Re: Normalising file names on macOS

2016-09-29 Thread Clark Cox
> On Sep 22, 2016, at 08:30, Ken Thomases wrote: > > On Sep 22, 2016, at 6:04 AM, John Brownie wrote: >> >> I find that I am in need of dealing with versions of strings that may be >> turned into file names, and thus I need to be comparing

Re: Normalising file names on macOS

2016-09-22 Thread Alastair Houghton
On 22 Sep 2016, at 16:30, Ken Thomases wrote: > > Without undermining Alastair's recommendations, you can achieve what you want > by round-tripping the string through -[NSString fileSystemRepresentation] and > -[NSFileManager stringWithFileSystemRepresentation:length:].

Re: Normalising file names on macOS

2016-09-22 Thread Ken Thomases
On Sep 22, 2016, at 6:04 AM, John Brownie wrote: > > I find that I am in need of dealing with versions of strings that may be > turned into file names, and thus I need to be comparing normalised forms. > However, according to >

Re: Normalising file names on macOS

2016-09-22 Thread John Brownie
Thanks, that sounds like a couple of good options. I'll try some options with the second one, and fall back on the first if necessary. Alastair Houghton wrote: My recommendation would be as follows: 1. If possible, don’t base the filename on the user’s input. Instead, generate your own

Re: Normalising file names on macOS

2016-09-22 Thread Alastair Houghton
On 22 Sep 2016, at 12:46, John Brownie wrote: > > OK, the situation is that the user provides a name, which comes in through a > standard text field in a dialog. That name is used as a key for a dictionary > which gives a collection of information about that item. It is

Re: Normalising file names on macOS

2016-09-22 Thread John Brownie
Alastair Houghton 22 September 2016 at 14:31 This is rather a hairy problem, actually. You don’t know that the filesystem is actually HFS+. The filename in question could refer to a file on an NTFS volume, or (in future) an APFS volume. It could also be

Re: Normalising file names on macOS

2016-09-22 Thread Alastair Houghton
On 22 Sep 2016, at 12:04, John Brownie wrote: > > I find that I am in need of dealing with versions of strings that may be > turned into file names, and thus I need to be comparing normalised forms. > However, according to >