Re: Normalisation of filenames
Re: Normalisation of filenames
- Subject: Re: Normalisation of filenames
- From: "Gerriet M. Denkmann" <email@hidden>
- Date: Sun, 02 Apr 2017 01:58:44 +0700
> On 2 Apr 2017, at 01:09, Quincey Morris <email@hidden> wrote:
>
> On Apr 1, 2017, at 04:41 , Gerriet M. Denkmann <email@hidden> wrote:
>>
>> for different values of path I got:
>> path = @“/ก่ี”; // consonant + mark + vowel → same = YES
>> path = @“/กี่”; // consonant + vowel + mark → same = YES
>>
>> Note: these two paths also look identical in Finder.
>>
>> I managed to store (using TextEdit) two of these identical looking files in the same folder.
>>
>> Is this a bug in NSURL or expected behaviour?
>
> What is the behavior that you think is a bug? If I understand correctly, you started from two different path strings, created URLs, and retrieved the path string from the URL. Why is it a bug to get the same path string out again each time?
Because, with path = “Bär” (with LATIN SMALL LETTER A WITH DIAERESIS) urlPath will contain “Bär” with LATIN SMALL LETTER A + COMBINING DIAERESIS.
Or, if you change the vowel ี to ู and path = mark + vowel, then urlPath will contain vowel + mark.
> If your question is about normalization, then there’s no particular reason to think that NSURL does anything about normalizing Unicode strings. That happens in the file system, but NSURL isn’t part of the file system.
I think that the examples above show, that NSURL does indeed do something about normalising Unicode strings.
The documentation explicitly says: "To avoid introducing bugs in your code with mismatched Unicode normalization in filenames:
• Use high-level Foundation APIs such as NSFileManager and NSURL when interacting with the filesystem”
> In addition, the fact that you created files under the two names suggests that the difference between the strings is not one of normalization.
You are right. But my point is that NSURL gets the normalisation wrong in this case; or at least that it is not very consistent in normalising strings.
Kind regards,
Gerriet.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden