seblucas / cops

Calibre OPDS (and HTML) PHP Server : web-based light alternative to Calibre content server / Calibre2OPDS to serve ebooks (epub, mobi, pdf, ...)
http://blog.slucas.fr/en/oss/calibre-opds-php-server
GNU General Public License v2.0
1.43k stars 229 forks source link

Bug: Author list accented letters are not grouped with non-accented #298

Open gczobel opened 8 years ago

gczobel commented 8 years ago

Hi, Some authors with an spanish last name have accented characters in the first letter. Example: "Úbeda, Francisco López de" Not sure about other languages but in Spanish accented letters must be grouped with non accented ones. So... á = a, é = e, í = i, ó = o and ú = u

In the authors list, I see different entries for authors with accented and non-accented first letter.

seblucas commented 8 years ago

It's a bug indeed but not one that can be easily fixed.

You can check https://github.com/seblucas/cops/issues/262#issuecomment-211400043 to see it's a long time problem. It would need specific extension to sqlite which are hard to handle with PHP.

In France, we also have diacritics (accentuated characters and some harder cases) and I have the same sorting problem. The only solution I have for now is to use https://github.com/seblucas/cops/blob/master/config_default.php#L291-L297. You won't see any accentuated anymore in your list but the list will be correctly sorted. But this parameter is really slow.

Ecksters commented 8 years ago

Perhaps Collator('bg_BG') might be a potential general solution, still not perfect though.

seblucas commented 8 years ago

That's true that I could sort the array in PHP (for now every sort was done by the database)

Ecksters commented 8 years ago

SQLite3 is supposed to support UTF8 encoding, and supposedly should sort it correctly, are we using that?

Rurik19 commented 8 years ago

I have suggestion - calibre has "sort_name" field in the authors table. May be we just can store non-accented letters in that field an use it to the sorting?

seblucas commented 8 years ago

@Ecksters

Thanks for the idea with Collator, it seems to work with French, I'll check the performance hit and will fix it soon

gczobel commented 7 years ago

Something new about this?