PHP: Updating with öäå into MySQL

2019-09-04 07:45发布

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 itself 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 = 'ööö'

2条回答
再贱就再见
2楼-- · 2019-09-04 07:56

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?

查看更多
【Aperson】
3楼-- · 2019-09-04 08:06

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.

查看更多
登录 后发表回答