日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > 数据库 >内容正文

数据库

mysql不能存字母,使用不常見的字母/符號時,MySql數據庫不能正確存儲數據

發布時間:2023/12/10 数据库 25 豆豆
生活随笔 收集整理的這篇文章主要介紹了 mysql不能存字母,使用不常見的字母/符號時,MySql數據庫不能正確存儲數據 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

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).

是的,這個問題需要一段時間,因為我最終忽略了它,但最近我不得不在不同的網站(使用相同的托管)做類似的事情。

總結

以上是生活随笔為你收集整理的mysql不能存字母,使用不常見的字母/符號時,MySql數據庫不能正確存儲數據的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。