I have a simple form that sends (via php) some variables to a mySql database.
我有一個簡單的表單,通過PHP發送一些變量到mySql數據庫。
The problem is that it's focused to Portuguese audience, and we use several unusual letters, like "ç" and "ã". Whenever someone sends data with those letters, the result is very "garbled" in the phpMyAdmin.
問題是它專注於葡萄牙觀眾,我們使用幾個不尋常的字母,如“ç”和“ã”。每當有人用這些字母發送數據時,phpMyAdmin中的結果都非常“亂碼”。
Quick example for a field would be "Escola de Condução Clássica" apears as "4573636f6c6120646520636f6e6475c383c2a7c383c2a36f20436c617373696361" in the phpMyAdmin.
一個字段的快速示例是“EscoladeTransçãoClássica”,在phpMyAdmin中為“4573636f6c6120646520636f6e6475c383c2a7c383c2a36f20436c617373696361”。
I tried setting the collation to "utf8_bin", with no avail.
我嘗試將排序規則設置為“utf8_bin”,但沒有用。
Any ideias?
Thank you.
EDIT: Field type is varchar(30) and charset shows as "utf8".
編輯:字段類型是varchar(30),字符集顯示為“utf8”。
2 个解决方案
#1
0
ALTER TABLE mytable CONVERT TO CHARACTER SET utf8
ALTER TABLE mytable CONVERT TO CHARACTER SET utf8
#2
0
I found out the problem. Turns out I just needed to call my hosting to change the php setting. I wish I had tried this beforehand, but I though it was something wrong on my end. Also, it makes no sense for them to have another encoding other than UTF-8, considering its a Portugal (european) based hosting.
我發現了問題。事實證明我只需要調用我的主機來更改php設置。我希望我事先嘗試過這個,但是我覺得這樣做有些不對勁。此外,考慮到它的葡萄牙(歐洲)主機,它們沒有其他編碼而不是UTF-8。
Anyway, if someone gets this error, try asking the hosting about which encoding is used in the php setting (it should have been UTF-8 in my case, might be diferent for you).
無論如何,如果有人收到此錯誤,請嘗試詢問托管在php設置中使用了哪種編碼(在我的情況下應該是UTF-8,對您來說可能不同)。
And yes, this problem took a while because I eventually ignored it, but I had to do something similar recently in a diferent site (using the same hosting).
是的,這個問題需要一段時間,因為我最終忽略了它,但最近我不得不在不同的網站(使用相同的托管)做類似的事情。