I have a table of character names in a mySQL database.
I am trying to query the table and sort them alphabetically by name.
Some of the characters have names like "The Dagda" and the "The " needs to be ignored so I am attempting to use:
select character_id, name from characters where is_del=0 order by trim('The ' from name)
Which seems to work...
Some of the other characters have UTF-8 characters in their names such as "Ériu"
However now when my table is returned I get these "É" entries listed between "A" & "B".
I.E.:
Aengus Amergin Ériu Balor Banba etc.
Preservation of these UTF characters is crucially important on the front end.
Does anyone know a method where I could have these "É" characters and similar be represented as "E" for purposes of sorting, but will still render in the dataset as what they actually are?
I am thinking before asking this that this may not be possible but I am hoping someone here might have run into a similar problem before and might have a workaround.
Thanks in advance.
EDIT: changed UTF-16 to UTF-8 (my bad)
EDIT @Rick James :
I could not format this readably in a comment but the hex of the query is as follows:
name | hex(name)
Aengus Óg | 41656E67757320C383E2809C67
Amergin | 416D657267696E
Ériu | C383E280B0726975
Balor | 42616C6F72
Banba | 42616E6261
The 3rd item down is Ériu - I am not sure why they are rendering as above but this is what is being displayed through the phpmyadmin interface when I run the query select character_id, name, hex(name) from characters order by trim('The ' from name)
The first character's full name should be Aengus Óg (I am assuming this is again down to character set or collation but I am unsure so apologies for the ignorance on my part here)