Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to tell what is my mySQL encoding (utf-8, windows-1255, etc)

I am using phpMyAdmin to manage my tables.

my database encoding is UTF-8 (I have changed its collation - inside 'operations' tab to utf8_general_ci).

The table's encoding is UTF-8 (I have changed its collation - inside 'operations' tab to utf8_general_ci).

and even the text fields inside the table are utf8_general_ci.

The thing is that with this the browser display weird question marks (but all other non-database text will appear correctly):

<meta HTTP-EQUIV="content-type" CONTENT="text/html; charset=UTF-8" />

and with this line the browser displays database-data correctly (but all other texts is unreadable):

<meta HTTP-EQUIV="content-type" CONTENT="text/html; charset=windows-1255" />

I assume that means the the database is encoded in "windows-1255" - but why ?! How can I define it to be utf-8 and display for me non-latin characters? Is there a way to do it in phpMyAdmin? and what am I doing wrong?

like image 510
Alon Avatar asked Dec 11 '25 15:12

Alon


1 Answers

Your database should be in UTF-8 (You can check it in PHPMyAdmin)
Your connection should be in UTF-8 (before first query: SET NAMES utf-8 or default somewhere in settings)
Your meta-tag or header should be UTF-8 (Content-type: text/html; charset=utf-8)

like image 120
RiaD Avatar answered Dec 14 '25 03:12

RiaD