Ensure that strings returned by wxMBConv_cf are in NFC form.

Normalize all Unicode strings used internally even though the Darwin kernel
gives them to us in decomposed (NFD) form.

Closes #11730.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66033 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2010-11-05 21:40:09 +00:00
parent dc36b43adf
commit 8244507f68
2 changed files with 11 additions and 2 deletions

View File

@@ -90,6 +90,14 @@ WXDLLIMPEXP_BASE wxMBConv* new_wxMBConv_cf(wxFontEncoding encoding)
if ( theString == NULL )
return wxCONV_FAILED;
// Ensure that the string is in canonical composed form (NFC): this is
// important because Darwin uses decomposed form (NFD) for e.g. file
// names but we want to use NFC internally.
wxCFRef<CFMutableStringRef>
cfMutableString(CFStringCreateMutableCopy(NULL, 0, theString));
CFStringNormalize(cfMutableString, kCFStringNormalizationFormC);
theString = cfMutableString;
/* NOTE: The string content includes the NULL element if the source string did
* That means we have to do nothing special because the destination will have
* the NULL element iff the source did and the NULL element will be included