Sorting of Virtual Pages with Umlauts/Accents in Title

I have a Kirby installation with virtual pages from a database following the recipe here.

One of the tables contains a list of international artists and some of them have Umlauts/Accents in ther Names, e.g. “Ábalos”.

I am converting the DB-result to pages and assigning the name as the title for the page following the recipe above like so:

    foreach ($result as $artist) {
        $artists[] = [
            'slug'     => $artist->kirby_slug(),
            'num'      => $num, //$artist->kirby_status() === 'listed' ? 0 : null,
            'template' => 'artist',
            'model'    => 'artist',
                'content'  => [
                    'title' => $artist->$name() ?? 'New Artist', 
                    …

In the panel all artists should be sorted alphabetically (num: zero), and the result from the DB is in the expected order, but somehow Kirby messes up the sorting when it does it’s magic:

In the panel, the artist named “Ábalos” appears as the last in the list of all artists. Somehow this is related to character encoding i guess, as a test made with a plain-kit and “normal” pages works fine. so i started fiddling around with converting the charset when assigning the title

'title' => iconv('UTF-8','ASCII//TRANSLIT', $artist->$name()) ?? 'New Artist',

which fixes the sorting but leads to the accent being stripped.

Any idea how i could tackle this?

I wonder why you want to convert utf-8 to ascii?

…i don’t want to! but so far it was the only way to get the sorting of pages to work in the panel. if i don’t convert to ASCII this is the sorting i get in the panel:

when converting to ASCII, i get this, which fixes the sorting but kills the accent of course:

image

Could you post your OS, PHP version and the locale you are using, esp. the value of LC_COLLATE?

Leave the output from the database as is an change the sorting in your blueprint:

sortBy: title asc SORT_LOCALE_STRING

Awesome Sonja! You made my day once again!