XML sorting problem with ÅÄÖ

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
Hi,

Im creating a list which gets data from an .XML-file. I sort it by using:


XDocument loadedData = XDocument.Load("course_db.xml");
var data = from query in loadedData.Descendants("Course")
orderby (string)query.Element("Name")
select new Course
{
name = (string)query.Element("Name"),
<span style="white-space:pre desc = (string)query.Element("Description"),
<span style="white-space:pre url = (string)query.Element("Url"),
<span style="white-space:pre location = new GeoCoordinate((double)query.Element("Latitude"), (double)query.Element("Longitude"))<br/>
};

And my .XML-file looks like this:

<?xml version="1.0" encoding="utf-8" ?>
<Courses>
<Course>
<span style="white-space:pre <Name>Hackstabanan</Name>
<span style="white-space:pre <Description>Ãkersberga. 18 korgar.</Description>
<span style="white-space:pre <Url>http://www.akersbergafk.com/</Url>
<span style="white-space:pre <Longitude>18.30541</Longitude>
<span style="white-space:pre <Latitude>59.487995</Latitude>
</Course>
...


The problem i have is that when a course is names e.g. Ãrebro it gets sorted as if it was named Orebro but in the list it is named Ãrebro.
So what I want is that citys starting with Ã,à or à gets sorted last (as in the Swedish alfabet). Ive also tried with encoding the .XML with ISO-8859-1 but got the same result...

View the full article
 
Back
Top