I'm having a problem with matching against french accented characters (note that other different characters such as chinese, japanese will also be used).
我遇到了与法语重音字符匹配的问题(请注意,还会使用其他不同的字符,例如中文,日文)。
I've ran across an error when I input a french street name that will check the database and I had an error:
当我输入一个将检查数据库的法语街道名称时,我遇到了错误,我遇到了错误:
Incorrect string value: '\xE2teau' for column 'street_name' at row 1
For this character in this name:
对于此名称中的此字符:
Le Château
I've changed my column to utf8_general_ci
and it still throws me that error. How can you "decode" them to match against a column?
我已经将我的专栏改为utf8_general_ci,它仍然让我错误。如何“解码”它们以匹配列?
1 个解决方案
#1
3
Are you actually sending UTF-8 data, or are you sending Latin-1 encoded data? MySQL may be choking on âte
because â
is being transmitted as the byte E2
and it expects a byte with a suitable value to come next, but sees the 74
for t
instead. Thus the string is not valid UTF-8.
您实际上是在发送UTF-8数据,还是在发送Latin-1编码数据? MySQL可能会窒息,因为â正在作为字节E2传输,并且它期望接下来有一个具有合适值的字节,但是看到74代替t。因此字符串无效UTF-8。
Try using utf8_encode()
on the string value before creating the query?
在创建查询之前尝试对字符串值使用utf8_encode()?
#1
3
Are you actually sending UTF-8 data, or are you sending Latin-1 encoded data? MySQL may be choking on âte
because â
is being transmitted as the byte E2
and it expects a byte with a suitable value to come next, but sees the 74
for t
instead. Thus the string is not valid UTF-8.
您实际上是在发送UTF-8数据,还是在发送Latin-1编码数据? MySQL可能会窒息,因为â正在作为字节E2传输,并且它期望接下来有一个具有合适值的字节,但是看到74代替t。因此字符串无效UTF-8。
Try using utf8_encode()
on the string value before creating the query?
在创建查询之前尝试对字符串值使用utf8_encode()?