开发者

French accented characters decode for SQL matching

开发者 https://www.devze.com 2023-03-05 14:50 出处:网络
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'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?


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.

Try using utf8_encode() on the string value before creating the query?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号