facebook twitter google+ linkedin reddit delicious stumbleupon

Sorting Unicode text

Gang stalking electronic harassment implants website sharing buttons gang stalking electronic harassment implants

gsehi.com > Computing > Problems > Sorting Unicode text

Problem

I need to sort Unicode filenames case insensitive and diacritics insensitive.

Solved

From UnicodeUtilities.h from Universal Interfaces 3.4.1:

typedef UInt32 UCCollateOptions;
enum {
										/* Sensitivity options*/
  kUCCollateComposeInsensitiveMask = 1L << 1,
  kUCCollateWidthInsensitiveMask = 1L << 2,
  kUCCollateCaseInsensitiveMask = 1L << 3,
  kUCCollateDiacritInsensitiveMask = 1L << 4, /* Other general options */
  kUCCollatePunctuationSignificantMask = 1L << 15, /* Number-handling options */
  kUCCollateDigitsOverrideMask  = 1L << 16,
  kUCCollateDigitsAsNumberMask  = 1L << 17
};

/* Simple collation using default locale*/

/*
 *  UCCompareTextDefault()
 *  
 *  Availability:
 *    Non-Carbon CFM:   in UnicodeUtilitiesLib 8.6 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 */
EXTERN_API_C( OSStatus )
UCCompareTextDefault(
  UCCollateOptions   options,
  const UniChar *    text1Ptr,
  UniCharCount       text1Length,
  const UniChar *    text2Ptr,
  UniCharCount       text2Length,
  Boolean *          equivalent,
  SInt32 *           order);

/* Simple locale-independent collation*/

/*
 *  UCCompareTextNoLocale()
 *  
 *  Availability:
 *    Non-Carbon CFM:   in UnicodeUtilitiesCoreLib 8.6 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 */
EXTERN_API_C( OSStatus )
UCCompareTextNoLocale(
  UCCollateOptions   options,
  const UniChar *    text1Ptr,
  UniCharCount       text1Length,
  const UniChar *    text2Ptr,
  UniCharCount       text2Length,
  Boolean *          equivalent,
  SInt32 *           order);

PDF file icon Unicode utilities API preliminary documentation by Apple (34.3 K, 13 pages).

© 2017 Cliff Huylebroeck