collate

D

Dag Henriksson

I'm trying to compare strings written in Swedish using:

std::locale loc(""); // System locale is Swedish
loc(first, second);

But this does not give me the right return value.
for example,

loc(string("å"), string("ä"));

should yield true, since 'å' is less than 'ä' in Swedish, but it doesn't.

Is this a bug?
 
B

Bo Persson

Dag Henriksson said:
Yes, I know that the C++ standard does not put any requirements on any
other facets than "C", but if an implementation can create a locale
named for example "Sweden_Swedish", shouldn't the collate facet in that
locale then follow the rules of Swedish, or are you saying that this is
impossible in Windows because the AscII of a letter depends of the
character set? Most lists I've seen of supported locales say what
charmap is used for each locale, for example ISO-8859-1 for Swedish, so
this should not be a problem.

Ok, I change my statement to "it might work". I see that in the latest
library collate<char> indirectly calls the undocumented function
_Strcoll. Don't know what that means though.

If you say that it still doesn't work, I'm not the least surprised.


Bo Persson
(e-mail address removed)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top