On Tue, 22 Jun 2004 13:12:33 +0100, Andrew L
<andrew_on_tour@operamail.com> wrote:
[color=blue]
>Hello all,
>
>What strategy should I use in solving the following problem? I have a list
>of unicode strings which I would like to compare with its English language
>'equivalent.' eg
>
>"reykjavík" (note the accent above the i) should match both "reykjavík" and
>"reykjavik" (being the English equivalent).
>
>Similarly the German language letter 'ß' should match "ss", umlauted a's,
>o's etc should match a,o etc.
>
>How would I go about doing this using the c++ stdlib?
>
>Many thanks,
>
>Andrew[/color]
You have to implement some kind of lookup table or dictionary.
Although STL supports locales, I don't think there is a way of
comparing two strings in *different* locales ... especially for
Unicode strings, since there is no locale for Unicode -- Unicode
covers *all* locales.
Also, there are many words which mean one thing in one language (or
locale) and something else in a different language, although they are
spelled exactly the same. "Band" in German might be a different word
than "band" in English, for example.
Even if you get rid of the special characters, you must really watch
out (e.g. German "Präservative" and English "preservative" <g>).
--
Bob Hairgrove
NoSpamPlease@Home.com