[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: a locale-independent search/replace?
From: |
Han-Wen Nienhuys |
Subject: |
Re: a locale-independent search/replace? |
Date: |
Sat, 24 Nov 2007 21:44:25 -0200 |
2007/11/24, Joe Neeman <address@hidden>:
> 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.
Do we have a use case for LC_ALL=ASCII ? Since we are using utf-8
everywhere, we might as well unset or overried LC_ALL in main().
> 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?
there is a int -> utf-8 routine in general-scheme.cc; I imagine it
would not be difficult to add a utf-8 -> int routine and use both to
the conversion without iconv.
--
Han-Wen Nienhuys - address@hidden - http://www.xs4all.nl/~hanwen