Fixing MediaMonkey's IUNICODE collation

Gene Michael Stover

created Sunday, 2025 May 4

original at cybertiggyr.com/iunicode.html


What is this?

You store your audio & video files in Media Monkey. You're writing your own programs to query the Media Monkey database. You're getting an error that the IUNICODE collation sequence is unknown.

The specific error I saw included “PHP Warning: SQLite3::query(): Unable to prepare statement: no such collation sequence: IUNICODE”.

In this file, I show you how to fix it. (It's easy.)

The fix

After you open the SQLite3 database, you can register a comparison function for the IUNICODE collation sequence.

SQLite3 provides a sqlite3_create_collation(...) function to do that.

I was working in PHP, so I did this...


  // I've omitted error checks from this example for clarity
  $db = new SQLite3($dbname);
  $db->createCollation("IUNICODE", "strnatcasecmp");
  $rows = $db->query("SELECT DISTINCT Genre FROM Songs");

Without the createCollation(...) call, I saw the aforementioned error.

Further information

Read about Collating Sequences & the sqlite3_create_collation(...) function at www.sqlite.org.

If you are working in PHP, read about the SQLite3::createCollation(...) method at php.net.

FAQs

Q1. Why didn't you enter this solution on any of the well-known sites where people asked about this error?

I tried to do so at 2 sites, but they wanted me to create an account. I have too many accounts & don't want more. I wasn't motivated enough to create a throw-away account nor to try other sites..

Change Log

whenwhowhat
2025-05-04genePlay.

cybertiggyr.com