Wish List.SortTypeUnicode

Discussion in 'Bugs & wishlist' started by asales, Jan 26, 2015.

  1. asales

    asales Well-Known Member Licensed User

    The SortType and SortTypeCaseInsensitive works fine, but not with accented characters.

    If already exists I don't know how to use it.

    If don't exists, I would like Case Insensitive and Unicode (to accented characters) version of SortType for Lists.
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    Both methods should work properly with any characters. Can you post an example that doesn't work for you?
     
  3. asales

    asales Well-Known Member Licensed User

    Hi Erel.
    I tried with this example:
    http://www.b4x.com/android/forum/threads/ultimatelistview-example.46277/
    Did not works with accented characters in the name of apps installed in device and use List.SortType.

    I made a similar (and simple) example, in attached.
    There are 2 database in file assets: cities.db and cities_noaccents.db.

    If I use cities.db and SortTypeCaseInsensitive or SortType the list shows, incorrectly:
    Code:
    -> SAO PAULO
    Salvador
    San Jose
    Santiago
    Sao Paulo
    Singapore
    Sofia
    -> SÃO PAULO
    -> São Paulo
    The list should be shown like this (correctly):
    Code:
    Salvador
    San Jose
    Santiago
    Sao Paulo
    -> SAO PAULO
    -> São Paulo
    -> SÃO PAULO
    Singapore
    Sofia
     

    Attached Files:

  4. Mahares

    Mahares Well Known Member Licensed User

    For your code project to work:
    Replace this:
    Code:
    dbCursor = dbSQL.ExecQuery("SELECT City, Country FROM Cities"' ORDER BY City
    With this:
    Code:
    dbCursor = dbSQL.ExecQuery("Select City,Country  FROM Cities ORDER BY (CASE SUBSTR(City,2,1)  WHEN 'Ã'  THEN REPLACE(City,'Ã','a') " _
    " WHEN  'ã'  THEN REPLACE(City,'ã','a')  ELSE City END) COLLATE NOCASE")
    Also comment or remove this line:
    ListCities.SortType("CityName",True) 'Needs commneted

    For your specific List question, I defer to Erel.
     
  5. asales

    asales Well-Known Member Licensed User

    Thanks @Mahares
    Portuguese language has several accented characters (Ã, Á, À, Â, Ç, É, Ê, etc...) and will be a huge SQL only to sort the list correctly.
    SQLite has a problem with sorted accented characters.

    I hope that I can use the SortType in this case, with help of @Erel .
     
  6. Mahares

    Mahares Well Known Member Licensed User

    Here is your project zipped modified to accommodate any name with with any accents. It will do exactly what you want. Please add the JavaObject library. Every code I added has this comment next to it: '1/27/15 Mahares
    Please run it and let us know. And if you still want Erel to respond to you, of course he will.
     

    Attached Files:

    Last edited: Jan 27, 2015
    asales likes this.
  7. asales

    asales Well-Known Member Licensed User

    Thank you very much, @Mahares .
    Very interesting modification.
    Works fine.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice