Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Core » Strings with national specific characters are wrongly sorted - Sort
Strings with national specific characters are wrongly sorted - Sort [message #57468] Wed, 25 August 2021 13:01 Go to previous message
Klugier is currently offline  Klugier
Messages: 1076
Registered: September 2012
Location: Poland, Kraków
Senior Contributor
Hello,

Today I found that sort returns wrong results in term of special characters:
#include <Core/Core.h>

using namespace Upp;

CONSOLE_APP_MAIN
{
	Vector<WString> vec = { "Zbig", "Ąć", "Ęc", "Ala", "Edward" };
	Sort(vec);
	
	for (const auto s : vec)
	{
		Cout() << s << "\n";
	}
}


The results are:
Ala
Edward
Zbig
Ąć
Ęc


and should be:
Ala
Ąć
Edward
Ęc
Zbig


This is probably corner case, because this world doesn't exist in Polish, but anyway the error is there. I believe it is more serve when these character are in the middle of the string and we have a lot of such words.

Here is the article about Polish alphabet and the order of letters.

Klugier


U++ - one framework to rule them all.

[Updated on: Wed, 25 August 2021 17:49]

Report message to a moderator

 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Probable nasty bug with StringBuffer
Next Topic: POSIX home directory symbol '~' is causing trouble
Goto Forum:
  


Current Time: Tue Apr 30 11:25:53 CEST 2024

Total time taken to generate the page: 0.04627 seconds