On 22 Sep 2016, at 12:04, John Brownie <john_brow...@sil.org> 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
> https://developer.apple.com/library/content/qa/qa1173/_index.html, "For
> example, HFS Plus (Mac OS Extended) uses a variant of Normal Form D in which
> U+2000 through U+2FFF, U+F900 through U+FAFF, and U+2F800 through U+2FAFF are
> not decomposed (this avoids problems with round trip conversions from old Mac
> text encodings)."
> Is there a way to get at this variant? [NSString
> decomposedStringWithCanonicalMapping] returns "A string made by normalizing
> the string’s contents using the Unicode Normalization Form D." That seems not
> to give what I need, but I haven't seen a better option. Is there such a
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 a network filesystem,
which could be mounted on a system running a completely different operating
system with unknown character encoding behaviour; typically UNIX behaviour, for
instance, is to completely ignore the filename encoding problem and treat
filenames as a string of bytes (thus you are free to interpret them as UTF-8 if
you so wish, but the filesystem will regard U+00E9 as different from U+0065
U+0301, even though the two names will display the same on screen).
Additionally, the version specified in HFS+ was based on a particular version
of the Unicode standard (I forget which), but importantly *not* the current
version, which is what the NSString APIs will use.
Perhaps we should start by understanding the context of your question. Is
there a specific reason you want to match the filesystem behaviour precisely?
Cocoa-dev mailing list (Cocoafirstname.lastname@example.org)
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 arch...@mail-archive.com