开发者

PHP: Updating with öäå into MySQL

开发者 https://www.devze.com 2023-01-14 16:54 出处:网络
I already have done this: mysql_set_charset(\"utf8\",$link); at the connection mysql_query(\"SET NAMES \'UTF8\'\"); at the connection + on every table in database

I already have done this:

mysql_set_charset("utf8",$link); at the connection

mysql_query("SET NAMES 'UTF8'"); at the connection + on every table in database

changing from latin1 to utf8 collation + character for every table + columns

file have meta utf8 + header('Content-Type: text/html; charset=utf-8'); plus the files itsel开发者_如何学Cf are formatted in utf-8( without bom)

where link is mysql_connect(), it shows the öäå characters fine when i take them out from database, but when i try to mysql_query UPDATE with stuff, that contains ÖÄÅ, it stores as Ã?¶à .. How can i fix this?

In the database the columns and so are, latin1_swedish_ci, as said it INSERT ÖÄÅs without problem, and echo it out too very well, but not when i try to UPDATE SET $user = 'ööö'


mysql_query("SET NAMES 'UTF8'") on every table in database

can you be more specific? I see no way to use this query on every table.

it stores as �¶à ..

how do you check it?


In the database the columns and so are, latin1_swedish_ci

This is your problem. You need to use a UTF-8 character set to store UTF-8 data.

What you are showing: �¶à is most likely UTF-8 data (which can consist of multiple bytes) being stored in a latin1 table.

0

精彩评论

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