UTF-8 X MySQL on XAMPP

Problems with the Windows version of XAMPP, questions, comments, and anything related.

UTF-8 X MySQL on XAMPP

Postby luisaurelio96 » 15. April 2016 20:02

Hello,

I have a problem with MySQL on XAMPP (no matter if you are running on Windows or Linux).
I am using XAMPP with PHP 7 (initially I used a XAMPP 5.6 on Xubuntu and the same problem occurs) in Windows 10 as my site development server. I set it:

  • The meta tag has UTF-8 in all HTML archives,
  • The PHP header function to send UTF -8 data,
  • The PHP directives, when I connect to the DB (I use MySQLi)
  • Code: Select all
    mysqli_set_charset($conexao, "utf-8");
  • Code: Select all
    setlocale(LC_ALL, 'pt_BR.utf8');
  • The default_coding on php.ini is setted for UTF_8,
  • And all the database is set in utf8_general_ci collation.

I used phpMyAdmin embedded in XAMPP to enter test data ,in the first test was creating fields in phpMyAdmin itself, in the second test used the feature to export data from a CSV file (the file has been set to UTF-8 encoding).

What happens is that when I try to make a query to the database and then try to display the data obtained from this query, accented characters are all with question marks, forcing to treat the information obtained from the database with the function utf8_encode.

I do not bother with it at the time, but when transferred my site to the production server (not XAMPP), the data coming from the database and treated with utf8_encode function were displaying (in all browsers) in place of those accented characters only question marks (?) and exclamations (!). I had to take the calls utf8_encode and solved the problem.

In both servers submitted the same SQL file and eventually occurring this difference in operation . The only difference is that the production server phpMyAdmin did not accept the following header of my SQL file:

Code: Select all
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */


Here are the server settings:
XAMPP deployment server:
  • PHP 7.0.4
  • MariaDB 10.1.10
  • phpMyAdmin 4.5.1
Production server:
  • PHP 7.0.4
  • phpMyAdmin 3.5.2.2
  • MariaDB 10.0.24

Please help me!

Kind regards,

Luis A. C.
luisaurelio96
 
Posts: 1
Joined: 15. April 2016 18:52
XAMPP version: 7.0.4
Operating System: Windows 10, Linux

Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 124 guests