Implement stringByFoldingWithOptions#600
Conversation
|
I'm waiting for this to get to a state where it compiles before going into detail, but from a quick look it seems basically fine. |
I've replaced the uses in my patch with libc |
|
@rfm CI is still failing on Clang+Windows because I did not know how to implemement locale sensitive lowercase folding without |
|
I don't understand why you are not using u_strToLower on windows. As far as I know the ICU support ought to be the same on windows as unix platforms. I did find a block suggesting a native alternative (LCMapStringEx) at https://devblogs.microsoft.com/oldnewthing/20241007-00/?p=110345 but that block also seem to suggest you can use u_strToLower |
04a7a22 to
07257cc
Compare
|
@rfm The PR builds now. Originally, I thought u_strToLower wasn't available on Windows. Seems like it is avaiable, but transliterators are not...? |
This PR implements
[stringByFoldingWithOptionsusing ICU transliterators.The behavior does not match Apple's implementation exactly, but I tried getting as close as possible:
NFD; [:Nonspacing Mark:] Remove; NFC, as explained in their documentation.u_strToLower, which is locale-aware.Additionally I added a caching optimization, which works similarly to how collators are handled.