jeecode
jeecode

Reputation: 1

UTF-8 not showed correctly since updating to MAMP PRO 4.0.6

I have updated my MAMP Pro to the 4.0.6 Version from 3.x today and since then I am having the problem that my local site on MAC OSX 10.11 is not supporting UTF-8 characters anymore.

So I am having for example the "ü" character in my mysql database which should show the "ü" character on my page but it does not, also when I am saving a "ü" character it saves it as a "ü" instead of "ü" in the database.

I am using the mysqli class and checked with the get_charset function that the charset of mysql connection is correct (utf8_general_ci). Also the local database and its tables have the right charset (utf8_general_ci).

I also added in the php.ini:

default_charset = "utf-8"

In my Apache http.conf I added the line

AddDefaultCharset utf-8

In my HTML-HEAD files I have the following line:

meta http-equiv="Content-Type" content="text/html; charset=utf-8"

Still the same problem, I am thankful for any help…

EDIT: As Roland Starke and junkfoofjunkie said in the comments its totally right to save the values in the database as "ü" and not "ü" (I did it wrong for a long time). It turned out that my MAMP 4 configuration was correct, but my MAMP 3 configuration was wrong. In addition my online version which runs on Amazon RDS was wrong and not configured in UTF-8 but in Latin1, seems like RDS always is in latin by default. I did what wtravish said to correct that: Converting RDS database to UTF-8

I also had to change the content, the following sql-code helped me:

UPDATE table_name SET
column_name = REPLACE(column_name ,'ß','ß'),
column_name = REPLACE(column_name ,'ä','ä'),
column_name = REPLACE(column_name ,'ü','ü'),
column_name = REPLACE(column_name ,'ö','ö'),
column_name = REPLACE(column_name ,'Ä','Ä'),
column_name = REPLACE(column_name ,'Ãœ','Ü'),
column_name = REPLACE(column_name ,'Ö','Ö'),
column_name = REPLACE(column_name ,'€','€'),
column_name = REPLACE(column_name ,'°','°');

Upvotes: 0

Views: 1378

Answers (1)

Juan Manuel De Castro
Juan Manuel De Castro

Reputation: 198

edit my.cnf and put this lines on [mysqld] section:

init_connect='SET collation_connection = utf8_unicode_ci'

init_connect='SET NAMES utf8'

character-set-server=utf8

collation-server=utf8_unicode_ci

skip-character-set-client-handshake

Upvotes: 0

Related Questions