Does anyone know how to write a simple search and replace for a UTF-8 string 
that works regardless of the current locale?

In order to fix bug 499, I tried to write a simple function that replaces all 
whitespace by spaces. My first attempt was pretty stupid -- I forgot that the 
string was in utf-8. This caused problems for "uiop" on the bug list. So I 
wrote a utf-8 version using mbrtowc and iswspace, but this fails if I set 
LC_ALL=ASCII because mbrtowc then thinks that all accented characters are 
invalid utf-8 sequences.

I suppose I could iconv to wchar_t, search, replace and iconv back but it 
seems that we don't currently depend on iconv and introducing a dependency 
seems like overkill. Am I missing something simple?

Joe


_______________________________________________
lilypond-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/lilypond-devel

Reply via email to