This question already has answers here:
strange character encoding of stored data , old script is showing them fine new one doesn't
(2 answers)
How do I see what character set a MySQL database / table / column is?
(17 answers)
UTF-8 all the way through
(13 answers)
Closed 1 year ago.
Short. I am moving a database and webpage. It is now an exact copy but on the webpage it doesnt display the swedish characters correctly.
Example
VÃƑ„RMARE should be VÄRMARE
In the old database it is VÄRMARE in the new it is VÄRMARE
It is an old webpage on an old php version that when i am moving will be a much later php version and a mariaDB.
I think it has to do with the collation in the database for the tables but in phpmyadmin 2.11.8.1 i can't se collation for the columns.
In the head i define
<meta charset="utf-8">
I don't even know where to start troubleshooting.
Any suggestions how to troubleshoot would be amazing for me.
Related
This question already has answers here:
How to make MySQL handle UTF-8 properly
(15 answers)
UTF-8 all the way through
(13 answers)
Closed 5 years ago.
I'm new to php, i made a php user interface with input fields that formulates, prints and execute a query showing the database reply or error.
It usually works fine but when i make a query with accented fields like in
"INSERT INTO `Nave` (`Targa`, `Nazionalità`, `Nome`) VALUES('0', 'italia', 'nave0');"
php successfully creates the query, prints and executes it without any further modifications but it fails saying "Unknown column 'Nazionalità' in 'field list'"
but if i copy/paste the same exact query printed by php into phpmyadmin it works (so obiouvsly the column 'Nazionalità' does exist) what is happening?
Notice that if the php generated query has no fields with accent it works even in php.
Notice also that individually neither my php nor mysql have any issues dealing with accent. so it's NOT a duplicate of How to make MySQL handle UTF-8 properly because that's a mysql individual issues, my database works fine.
EDIT: All the answers so far explained how to fix the database, but the database does works fine!
I do not know how to make it understand that, read more about the question guys...
But the second duplicate suggestion was quite right and there i found my solution which I copy here for convenience of those who will visit this page having the same problem: "$mysqli->set_charset('put here the same charset used in your db');" OR "mysqli_set_charset($link, 'charset');"
Thank for your help.
change your character set of database to UTF-8 by following MySQL query
ALTER TABLE Nave CONVERT TO CHARACTER SET utf8;
This question already has answers here:
UTF-8 all the way through
(13 answers)
Closed 6 years ago.
I recently upgraded my site to PHP 5.7 and a new install of the MySQL database. The previous data was imported.
Now I have a lot of the question marks in diamonds in outputted text. I have read up, and the problem seems to be that the collation of my database is set to latin1_swedish_ci and I need to be utf8 to correctly render special characters stored in the database.
If I change the collation will this potentially solve my problem, fixing the older postings?
Do I switch off the site before changing the collation, and does it require a reboot to take effect? I'm a little nervous about corrupting the data as my users would be extremely upset to lose their historical postings.
I am not setting up a new database, I've upgraded an existing database, and need to keep the historical data.
I followed one of the answers posted below and it worked for data that was inputted into the database before the upgrade, but now renders newer data with various “ in place of apostrophes, etc.
You can use
$con = mysqli_connect("HOST","DB_USER","PASSWORD","DB_NAME");
$db->set_charset('utf8');
OR
mysql_query('SET NAMES utf8');
This question already has answers here:
UTF-8 all the way through
(13 answers)
Closed 7 years ago.
I am making an android application that sends some TEXT to server and other people can see those Text but the problem is here when I send the TEXT it looks like this (سلام به همه) in the MYSQL table inside the server and it shows the text like this (???????????) (By the way I am writing the text in Persian) to the people who get the text and also when I add some records manually inside the database it also shows like question marks on the PHONE.
I tried puting database and tables Collation to utf8_general_ci and utf8_persian_ci but it did not work.
How do you send the data to the server, is it via a PHP Service? If so, I once had a problem with Cyrillic and setting the connection itself to UTF8 helped.
Here's the statement if you are using mysqli but I think there's an alternative for PDO as well.
mysqli_set_charset($con,"utf8");
This question already has answers here:
UTF-8 all the way through
(13 answers)
Closed 8 years ago.
I'm building a php search page for a photo gallery to pull data with Chinese characters from MySQL.
I've done the following:
1. setting webpage to utf-8 encoding meta http-equiv="content-type" content="text/html";charset="utf-8"
2. ensure that the collation for mysql db and data itself is utf8_general_ci
3. set chrome encoding to utf-8.
But when I put in a positive search string to pull data with Chinese characters, they always come up as ???
I've checked my php array raw output and it is also ??? which leads me to believe there is something wrong at my database end. But I need to add is my gallery page (where the search box is embedded) displays the Chinese characters correctly from the same database.
Have you also set $mysqli->set_charset('utf8'); ?
This question already has answers here:
UTF-8 all the way through
(13 answers)
Insert into a table which has a dash in the name
(4 answers)
Closed 8 years ago.
While inserting data "Jack - Jill" in mysql db, it saving as "Jack †Jill“, my problem is when i tried to display the string in page its showing like "Jack �€� Jill", i am just botherd to display the string properly like "Jack - Jill", i tried have proper charactersets but not much of luck.
make sure you specify the charset used by your page to the database (and all its tables), and the other way around. i.e.:
Give your page a metatag and the script witing to the database a line that either validates that the charset is UTF-8 (example charset), or that it converts the chaarset to UTF-8
and give your database the same property, that it saves and reads data as UTF-8 (i use PHPMyAdmin, if you use such GUI tools too, its just a checkbox away).
hope i pointed you into the right direction