I have a Multilingual Wordpress website on my host (which someone else built), and I want to install a copy of this site on Xampp so that I can make changes.
I don't know phpmyadmin & mysql very well. Usually I just use utf8_general_ci for everything.
After exporting and importing, I kept getting syntax errors. So... I figured this was due to the collation & charset of the database? I checked in the database and next to some of the columns it says "utf8_general_ci", and next to others it says "utf8_unicode_ci", and then at the bottom of the table it says "latin1_swedish_ci". So now I have no clue what the collation of this database is...
How do I know what the collation & charsets of this database is? And how do I export and import everything as is? I heard phpmyadmin automatically converts databases during export... is this true? What must I do to get this database exported and imported correctly?
Related
This question already has answers here:
UTF-8 all the way through
(13 answers)
Closed 12 months ago.
I'm migrating my existent database into another server. To achieve that I've exported and imported the database using phpMyAdmin SQL queries. Everything works fine, except that some UTF-8 characters appear broken in the website. I fetch them using the same PHP code (on a different server but with same PHP extensions and version).
Example of a string as I see it on the new website and on the databases (both old and new) (using phpMyAdmin): péri-prothétique
Example of a string as I see it in the old website péri-prothétique
As you can see, PHP used to automatically encode the characters the right way even thought the characters are mangled in the database, but doesn't do so anymore (not even if i explicitly utf8_encode or utf8_decode the result). I even tried forcing $mysqli->set_charset("UTF8") on every connection to no avail.
Both the web server, the database server,server connection, PHP and the tables use UTF-8 or utf8mb4 charset and collation, and are setup the same way as the old ones.
The only difference I see is that the new database server is MariaDB instead of MySQL and its webserver is nginx instead of Apache.
New database specs picture from phpMyAdmin:
Old database specs picture:
New webserver specs on which the website and PHP runs (same specs as old one but different server):
Apache 2.4 PHP 7.0
How can I get back that old correct encoding? Why doesn't PHP automatically decode them right anymore?
UPDATE:
Using mb_detect_encoding I see that PHP in both new and old version detects ASCII or UTF-8 on the query results, depending on whether there's at least an UTF-8 symbol or not.
The issue is that on the new version PHP doesn't display the UTF-8 symbols right even thought it detects the string encoding as UTF-8.
UPDATE 2:
thanks to this question I figured out why my entries were mangled: double encoding arose from the fact that the database collation was latin1_swedish_ci while the tables collation was utf8_general_ci.
This doesn't answer the question thought since the old website was automatically "translating" those mangled characters, rendering them right in the HTML, and I want to replicate that behavior into the new website which is a different one but with the same code and php.ini settings.
To check for double encoding, use SELECT HEX(col)... é should come back C3A9 (proper utf8), but instead shows C383C2A9 (double encoding).
See: Trouble with UTF-8 characters; what I see is not what I stored
If you have actually determined that you have double encoding, then the fix involves
UPDATE tbl SET col = CONVERT(BINARY(CONVERT(col USING latin1)) USING utf8mb4);
See http://mysql.rjweb.org/doc.php/charcoll#fixes_for_various_cases
Yes, "double encoding" is a silent bug -- two wrongs make a right (sort of).
I think that you should check for your MariaDB configuration.
First check your php code in order to know if there isn't misleading typo ( but i think it doesn't)
Second, check for your MariaDB database/tables structure [extracted from here ]:
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA;
Third, check for your MariaDB files config (my.cnf)[extracted from here ] :
[client]
default-character-set = utf8mb4
[mysqld]
character-set-server = utf8mb4
Then restart your server :
mysql.server restart
Hope it will help you to fix your problem bro.
Bye
Are you expecting the changes on existing data? It will not work. You need to add the data again to see the changes. Remove all the data from the new database and add again.
I use Macs.
For years I have been updating the content of an ExpressionEngine website based on PHP/MySQL. This process involves linking the content of InDesign pages to a Filemaker database, exporting specified fields to an Excel spreadsheet and using Navicat to update corresponding fields in the MySQL database. I know from experiments in linking Filemaker directly to MySQL that character encoding is a minefield.
The process I have outlined has always worked OK, provided in the Navicat import step I specify that the Excel spreadsheet is using Mac OS Roman encoding. This year, however, the result of the updating was garbage where I should have accented characters or fancy "typesetting" characters - en rules, inverted commmas etc.
What had changed? Well, I am using a new Mac, running Yosemite. I still have my old iMac, now in use as a second display, so I went back to that. Result: perfect. No garbage.
I have of course checked that the Excel file's text looks OK. (I am using the same file on both Macs, shared via Dropbox.) I'm running the same version of Navicat on both Macs.
So what is Yosemite doing to cause Navicat to stuff different characters into MySQL? And how can I stop it?
Chris
I have a TYPO3 4.5.37 website which works perfect on my local windows enviorement, but after uploading it to a Linux environment I get a broken front-end (the back-end is functioning normally) see:
What I already tried;
Converted all database tables to a utf8_general_ci collation
[BE][forceCharset] = utf-8
[SYS][setDBinit] = SET NAMES utf8;
When I drop my database (so there is no connection) the problem with the output is still there so I think this has nothing to do with the database.
The website outputs the front-end with TemplaVoila, I updated TemplaVoila from 1.6.x to 1.9.2 but this didn't work.
On the same server are a lot of other working TYPO3 sites hosted so this has probably nothing to do with the server settings.
I'm running out of options now. So I hope somebody can help me out here.
I found the problem. The compressionLevel was set to '1' in the install tool, when turned off the problem with the encoding on the front-end disappeared.
[FE][compressionLevel]
Determines output compression of BE output. Makes output smaller but
slows down the page generation depending on the compression level.
Requires a) zlib in your PHP installation and b) special rewrite rules
for .css.gzip and .js.gzip (please see _.htacces for an example).
Range 1-9, where 1 is least compression and 9 is greatest compression.
'true' as value will set the compression based on the PHP default
settings (usually 5). Suggested and most optimal value is 5.
I used an Oracle 11g EE to create my database and access it through PHP using PDO, and all was working good. But i had to change to 11g XE because i wanted to use it freely inside my company. Now, greek characters won't display on PHP (i get �������� instead). I tried to change the character set with :
shutdown immediate;
startup mount;
alter system enable restricted session;
alter system set job_queue_processes=0;
alter database open;
alter database character set internal_use EL8MSWIN1253;
shutdown immediate;
startup;
But i ended up corrupting the CLOBs.
Now, after reverting to the last known good backup i am trying to use CSSCAN but i cannot find it inside my bin folder or anywhere to download.
Any thoughts on this??
I really need to make it work..
Hi I am storing some images in MySQL DB in a LONGBLOB field. Whenever this image is stored MySQL sets the function for this column to UNHEX. I dont want this to be automatically set to that. My BLOBs used to work fine when this was not set. How do I remove this UNHEX being set by default.
I am using phpmyadmin, MySQL, InnoDB and PHP to retrieve those images. I used to get back the images perfectly fine before we migrated to a new version of phpmyadmin.
Please help.
If you check the phpmyadmin changelog (http://demo.phpmyadmin.net/master-config/changelog.php), it does appear there are a few issues noted regarding this problem with earlier versions of PMA (see the note under 3.4.0.0 about defaulting to UNHEX). You might want to upgrade to the latest version and see if these problems still exist.