Hello/Hi/Greetings,
This is the norwegian alphabet:
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z Æ Ø Å
But how do i get Piwigo to automatically sort the pictures and albums in this order??
As you can see we have ÆØÅ at the end.
Piwigo 13.4
Best Regards
Robert
Piwigo URL: http://
Last edited by BigIsland270972 (2023-01-18 17:25:30)
Offline
It looks like A and Å is sorted at the beginning.But A is the first letter and Å is the last letter.
Offline
Album sorting (assuming that the code in question for sorting album names is in admin/albums.php the array_multisort() call), maybe to cater for stupid non-UTF-8 environments, does some crappy thing where it calls a remove_accents() function on strings to be compared, so A and Å are equivalent. But even without that, the PHP SORT_REGULAR likely (hopefully) uses standard untailored Unicode Collation Algorithm (UCA) with the same result. Iff your web server runs in the proper Norwegian locale (either nb_NO.UTF-8 for Norwegian Bokmål or nn_NO.UTF-8 for Norwegian Nynorsk) then you could try to comment out the remove_accents() call on line 107 and in the array_multisort() call on line 118 change the SORT_REGULAR to SORT_LOCALE_STRING. After that you'd have to change album sort order twice, once to some other sorting and then back to name.
For picture names it gets hairy and I don't have an adhoc ready solution. It involves setting the MySQL database piwigo_images tables' collation, so if that is utf8mb4 or utf8mb4_general_ci or utf8mb4_unicode_ci (or utf8mb3... or utf8...), you could try to set it to utf8mb4_danish_ci (there is no ..._norwegian_ci) and see whether that works out already. See https://dev.mysql.com/doc/refman/5.7/en … -sets.html
Whatever you do, do backups before..
Offline
since mysql 8.0.30 there is utf8mb4_nb_0900_ai_ci
but you should test
Offline
Ah right, MySQL 8 added better Unicode support.
https://dev.mysql.com/doc/refman/8.0/en … -sets.html
And it gets a little more complicated. One could specify database and/or table character sets.
https://dev.mysql.com/doc/refman/8.0/en … yntax.html
Piwigo creates new tables with the collation specified as
define('DB_COLLATE', '');
in local/config/database.inc.php (default empty).
Best would be if Piwigo also supported the COLLATE clause when select querying with ORDER BY and use a collation as specified by the user / Piwigo admin.
https://dev.mysql.com/doc/refman/8.0/en … llate.html
Offline
erAck wrote:
Album sorting (assuming that the code in question for sorting album names is in admin/albums.php the array_multisort() call), maybe to cater for stupid non-UTF-8 environments, does some crappy thing where it calls a remove_accents() function on strings to be compared, so A and Å are equivalent. But even without that, the PHP SORT_REGULAR likely (hopefully) uses standard untailored Unicode Collation Algorithm (UCA) with the same result. Iff your web server runs in the proper Norwegian locale (either nb_NO.UTF-8 for Norwegian Bokmål or nn_NO.UTF-8 for Norwegian Nynorsk) then you could try to comment out the remove_accents() call on line 107 and in the array_multisort() call on line 118 change the SORT_REGULAR to SORT_LOCALE_STRING. After that you'd have to change album sort order twice, once to some other sorting and then back to name.
For picture names it gets hairy and I don't have an adhoc ready solution. It involves setting the MySQL database piwigo_images tables' collation, so if that is utf8mb4 or utf8mb4_general_ci or utf8mb4_unicode_ci (or utf8mb3... or utf8...), you could try to set it to utf8mb4_danish_ci (there is no ..._norwegian_ci) and see whether that works out already. See https://dev.mysql.com/doc/refman/5.7/en … -sets.html
Whatever you do, do backups before..
Your suggestion kind of worked but ÆØÅ is now sorted ÆÅØ :)
Offline