1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Recordset sort with the Swedish letters å, ä and ö

Discussion in 'C#' started by bencene, Sep 14, 2010.

  1. #1
    Hi! I hope someone can help with this. I have a standalone recordset with an array that I am sorting in alphabetical order. I'm writing in Swedish so the swedish letters å, ä and ö is appearing in the values. This letters are the three last letters of the Swedish alphabet.

    I am not using any database or database connection just a stand alone recordset to sort an array as you can see in my test code below:

    
    <% session.lcid=1053 %>
    
    <%
    ' set Const for recordset
    Const adVarChar = 200
    Const adInteger = 3
    Const adDate = 7
    
    ' create a recordset to store the information in
    set rs = Server.CreateObject("ADODB.RecordSet")
    
    
    rs.Fields.Append "filename", adVarChar, 255
    rs.Open
    
    
    ' Redim the array with the new number of items
    Redim PRESERVE myArray(1,0)
    ' add the information to the recordset
    rs.AddNew
    rs.Fields("filename").Value = "Anka"
    rs.Update
    
    Redim PRESERVE myArray(1,0)
    rs.AddNew
    rs.Fields("filename").Value = "Ranka"
    rs.Update
    
    Redim PRESERVE myArray(1,0)
    rs.AddNew
    rs.Fields("filename").Value = "Planka"
    rs.Update
    
    Redim PRESERVE myArray(1,0)
    rs.AddNew
    rs.Fields("filename").Value = "Ã…nka"
    rs.Update
    
    Redim PRESERVE myArray(1,0)
    rs.AddNew
    rs.Fields("filename").Value = "Önka"
    rs.Update
    
    
    rs.Sort = "filename ASC"
    
    do while not rs.EOF
    %>
    
    
    <% = rs("filename") %>
    
    
    <%
    rs.MoveNext
    loop
    rs.Close
    set rs = Nothing
    %>
    
    Code (markup):
    Thanks in advance for any help in this matter.
     
    bencene, Sep 14, 2010 IP
  2. bencene

    bencene Peon

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Sorry all. I just realized I actually did not ask my question in my original post. My appologies.
    Anyway, the recordset does not sort on the Swedish charecters å, ä and ö correctly. They should come last, but are sorted as if they where "a" and "o" instead.

    I have tried to set the Session.CodePage but it just changing the characters depending on which code I'm using. Any ideas anyone?
     
    bencene, Sep 15, 2010 IP
  3. AstarothSolutions

    AstarothSolutions Peon

    Messages:
    2,680
    Likes Received:
    77
    Best Answers:
    0
    Trophy Points:
    0
    #3
    You need to set the culture correctly for it to understand that these are swedish characters rather than simply an accented A
     
    AstarothSolutions, Sep 16, 2010 IP
  4. bencene

    bencene Peon

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    So how would I do that? Not sure what you mean by "culture". I'm afraid I'm not familiar with this. Can you guide me?
     
    bencene, Sep 16, 2010 IP
  5. bencene

    bencene Peon

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    I guess you were refering to the language setting on the server? Anyway, I have now figured it out. The recordset in its original code is working since I now changed the language settings on my server. I did check this before and it was set on Swedish, but there was an additional setting I missed. Thank you for your help and sorry for my misstake. ;)
     
    bencene, Sep 22, 2010 IP