Page 1 of 1

How to collate hyphens with spaces?

Posted: Wed Jun 13, 2007 4:41 pm
by GuyGordon
I am working with a MySQL table of old magazine names. With the default latin1_swedish_ci, when I list magazines alphabetically names like 'Action-Packed Detective' end up after all names like 'Action Packed Western', because the hyphen sorts below the space.

I want to treat hyphens and spaces the same. Does anyone know how to do this? Is there an existing collation that already does this?

It would seem that I could edit the file MySQL\share\charsets\latin1.xml and add a new collation. I could copy the section <collation name="latin1_swedish_ci">, rename it "latin1_gordon_ci", and make one change (2D->20) giving the hyphen the same priority as space. I've done that, but the new collation does not automatically show up in MySQL after restarting.

Since MySQL is running on Windows here, I use the Windows Binaries supplied by MySQL AB. Would I have to compile my own to introduce a new collation? Or is there some command that tells it to load this file?