473,394 Members | 1,674 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

collate

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?

--
Dag Henriksson
Nov 16 '05 #1
1 1252

"Dag Henriksson" <da************@quidsoft.se> skrev i meddelandet
news:%2****************@TK2MSFTNGP11.phx.gbl...
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?


Well, not really, it just doesn't work.

The C++ standard doesn't say much what happens for letters outside of a-z. In Windows their positions even varies between different
character sets (try looking at them with the program
"Teckenuppsättning"). Most often 'ä' comes before 'å' (in an area
filled with varying sets of other accented glyphs that are not
"proper" letters).


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
bo**@telia.com


All book I have read suggests that it should be possible to compare
strings according to local rules using collate. See for example
http://www.research.att.com/~bs/3rd_loc.pdf
where Stroustrup writes:
"given the dk locale, we can construct a locale that reads and compares strings according to the rules of Danish (that give three extra vowels compared to English)"

But maybe I've misunderstood something...

--
Dag Henriksson


Nov 16 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: MADS | last post by:
Hi, I have a SQL Server for a SAP database with the collation SQL_Latin1_General_CP850_BIN. When I connect to that server (or, in this example, to another server with the...
4
by: Nanchil | last post by:
Hi, We created a database (DB2 UDB 7.2 on solaris 8) without this (COLLATE USING IDENTITY ) option. But we need this now for binary sorting. The database is siebel database. Is it possible to drop...
0
by: Francisco Araujo | last post by:
I don't know if this is a bug or if i'm doing something wrong, but when the print dialog is shown on VB.NET and the user select multiple-copies and check the collate option and click ok, the...
3
by: Robert Liles | last post by:
I am using Visual Basic.NET 2002 and cannot get "collate" from the PrintDialog1 or e.PageSettings.PrinterSettings.Collate to return anything but "False." What am I doing wrong? I am using...
0
by: Robert Liles | last post by:
If I check the "Collate" box in the PrintDialog it is ignored, always returns "False" and does not collate. If I add the line " e.PageSettings.PrinterSettings.Collate = True" in my print routine,...
1
by: Zengfa Gao | last post by:
Hi, all: I have a schema definition, worked fine for PostgreSQL 7.2 and 7.3. But I saw errors when I use it on PostgreSQL 7.4. Can anyone tell me what's changed in 7.4? Thanks a lot!
0
by: Ron Adam | last post by:
I've made a few more changes to my little collate module. There might be better ways to handle the options, or better choices for the options themselves. I tried to keep it as general as...
1
by: mabubakarpk | last post by:
HI. I am using SQL Server 2000. I generate a script of some table from EmpDB database when I run script in query analyzer it return error "Incorrect syntax near 'COLLATE'." Scripts is ...
1
by: baburk | last post by:
CREATE TABLE Employees( EmployeeID int IDENTITY(1,1) NOT NULL, LastName nvarchar(20) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL) What is use of Collate. In what are all the places can we...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.