convert-case icon indicating copy to clipboard operation
convert-case copied to clipboard

to_case() - Fail with words with accent mark

Open trapalleiro-git opened this issue 3 years ago • 1 comments

to_case() fail with words With accent mark. Example: música moderna.

trapalleiro-git avatar Jul 05 '22 17:07 trapalleiro-git

Thank you for bringing this up. I made the mistake of manually stepping through bytes of strings, when they may not necessarily be character boundaries for non-ascii characters. The algorithm I made breaks character boundaries in this case. The solution is to integrate the "unicode-segmentation" library to step through strings without failing. This is in development, and will update this issue when it is resolved. Thanks again for the issue.

rutrum avatar Jul 07 '22 13:07 rutrum

I have added unicode-segmentation as a dependency, and added a test which specifically addresses the string you provided. The newest version, convert-case version 0.6.0 fixes this issue. https://github.com/rutrum/convert-case/blob/a8702a05217664ca59cb7471df68a91dcf4b91ee/src/lib.rs#L650-L653

rutrum avatar Sep 10 '22 15:09 rutrum