I have a few textfiles which are input for a MySQL database. These textfiles contain characters like é and ë. I have struggled getting the data properly into the database and now it seems I've finally got it right. However, I would like to know if there is a better way to do this than the way I describe here.
- The textfiles are all UTF-8 encoded.
- The PHP scripts are all UTF-8 encoded as well. I've read that this is very important.
- All HTML output is done using a header like this:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- The MySQL database is created using a collation of latin1_swedish_ci (the character set is left blank)
- All the columns that contain characters (VARCHAR) are defined using a collation of latin1_swedish_ci
I assume the right way to store url encoded strings is when I see the character é stored as %C3%A9 in the database. I found a MySQL function for urlencoding here. But when I open up phpMyAdmin I see the character é is presented as %C3%A3%C2%A9.
I can add another statement to replace characters in the database, but something tells me there is a more efficient way to achieve this.
Any help is greatly appreciated. Thanks in advance.