Wordpress site showing special charactors in site - php

My customer has a WordPress site and last week we have migrated it to a cPanel server after that the site showing special characters like ! and ? in the website. Can somebody let me know how to remove this?
Server: Centos 6
cPanel: WHM 56.0
PHP : 5.6.23
MySQL : 5.6

It's UTF8 Encoding problem, sometimes it happens when you migrate wordpress site from one host to another, you should select correct character set while exporting database backup.
Open and edit your WordPress wp-config.php file. Then find the following two lines and if it is not like that then you should change them as shown below.
define('DB_CHARSET', 'utf8');
define('DB_COLLATE', ');
If this doesn't work try googling "special character problem wordpress"

PHP 5.6 changes the default value of default_charset to UTF-8. Change that value to ISO-8859-1 in your php.ini file and restart apache. See if that fix the issue.
Or convert the encoding of php textfiles to utf8 and don't change defaults.

Related

NetBeans Doesn't Display Chinese Content

Good day,
My dev pc env like this,
Win11 and NetBeans16 installed. I am dev PHP Lang now.
When I opened an existing source code folder and I found these Chinese content can't display normally.( Pls see screen capture posted as below)
I already tried several methods as below,
I configured the NetBeans Project Encoding to UTF-8; // doesn't work
I tried to type simple Chinese content in the IDE directly; // Same issue
I googled and modified the 'netbeans.conf' file and added the
-J-Dfile.encoding=UTF-8
at the end of netbeans_default_options=" , and then I restarted my NetBeans or enen I reboot my win OS. The problem is still can't resolve.
BTW,
I could view the Chinese content in Visula Studio Code via my PC.
And I configured my DB encode to UTF-8 Unicode (utf8mb4).
Thks for your suggestions in advance.
Followed Skomisa's suggestion. I solved the issue as below,
I must choose one font that support Chinese character and then I could render it in NetBeans edit window.(as I commented above)
See the result attached.

Uploaded Image file name encoding/charset in Wordpress

I have a pretty weird problem that I have not faced before, and with a 2-hour search I had no results;
I recently migrated a wordpress site, what I did was;
Export database and import on new server (via phpMyAdmin)
Copy Wordpress client files to new database.
Edit wp-config.php relative to new database information.
Everything was working correctly, but only problem was, in new server some of images that is used in posts or as thumbnails are not showing in browser (probably due to Turkish unsafe chars).
As an example, if I inspect the link of the image, wordpress redirects me to 404 page;
File name: çiğ-beslenme-mi-yoksa-pişirmek-mi.jpg
How wordpress prints it:
wp-content/uploads/2017/01/%C3%A7i%C4%9F-beslenme-mi-yoksa-pi%C5%9Firmek-mi.jpg
How I can access it via browser:
wp-content/uploads/2017/01/c%CC%A7ig%CC%86-beslenme-mi-yoksa-pis%CC%A7irmek-mi.jpg
For example, for the char ç wordpress prints; %C3%A7 and it is accessible with c%CC%A7
As you can see, I can add a c letter before printing ç and change %CC%A7 with %C3%A7 or s before ş, this way, images gets shown again. But I would like to know what is the problem here, or what is the cause of this.
I would love that if there is anyone out there, have a better understanding on charsets illuminate me. I'm positive this would occur with German or Dannish also, since these languages has unsafe latin letters too.
Additional information;
Its a LAMP, no control panel software.
PHP Version 7.0.13-0ubuntu0.16.04.1
Apache/2.4.18 (Ubuntu)
mysqlnd 5.0.12-dev
PHP charset: UTF-8
Charset in mysql tables (?) utf8mb4_unicode_520_ci
If needed I can add more information in demand.

WAMP/MySQL errors not in correct language

I've re-installed WAMP multiple times, searched literally hundreds of pages, and its not fixed this issue:
I've looked inside the phpmyadmin config files, set:
$cfg['Lang'] = 'en-utf-8';
Uninstalled multiple times (as mentioned) and seemed to have no luck what so ever. Any help would be appreciated.
To change the language that MySQL uses when reporting you need to change the my.ini file as follows.
Find this line:
# Change your locale here !
lc-messages=fr_FR
And change it to your prefered language, for example:
lc-messages=en_GB
To change it to English US, you can do like this:
lc-messages=en_US
Save the file and then restart MySQL.
left click wampmanager icon -> MySQL -> Service -> Restart Service
Remember the guys that produce WampServer are French so I guess thats why this has been added to the my.ini file, and they just forgot to remove it on this release.
How to Find my.ini in WAMPServer
Use the wampmanager menus like so :-
left click wampmanager icon -> MySQL -> my.ini
This will load the my.ini file into your editor.
Here you can find a list of valid locales
Change the following settings in my.ini file
lc-messages=en_US
To permanently change the language preferences
$cfg['Lang'] = 'en-utf-8'; and friends change the language for phpmysql, not for the mysql server, so anything coming from the database server itself will be unaffected.
You need to start the server daemon with --lc_messages=en_US (or put that in the relevant config file), for a per-session setting just use SET lc_messages = 'en_US';

Charset of Apache (XAMPP) Server

I run a XAMPP Apache PHP Server on my Mac and I am facing the following problem: German special characters like ä ö ü and ß are displayed with strange questiontags instead of the correct symbol. I assume a misconfiguration of the server, since the files are all saved in UTF-8 and contain
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
In the -Tag of the files.
Anyone an idea how to get rid of those � ? I thought already of the httpd.conf , but there is already something like
#UTF 8
AddDefaultCharset utf-8
in it. The php.ini also includes
default_charset = "utf-8“
I really dont know how to proceed and my whole page looks not as nice as it should with those strange question tags...
Thanks for your Help!
Tim
I was having the same problem on my XAMPP local server and none of those things worked for me. The problem was in the transfer of data between mySQL (where all my foreign language looked good) and the server (where everything seemed good too). I was just missing this one statement in my.ini
"character_set_server=utf8"
which seems to affect data communication beetween server and mySQL
DON't change any other UTF-8 statements at the same time!
I run into the same problem after updating XAMPP.
I am using an other charset to display all kinds of characters used in countries like Holland, Germany, Norway, Sweden en Denmark. So my HTML contains:
Changing the default-charset into "windows-1252" did the trick for me.
Did you type these characters inside the source file? In this case, which encoding was the source file saved in?
With that meta tag "Content-Type" you are telling the browser to interpret the page as UTF-8 (despite whatever other value the server is returning). However, if you are saving the file in a different encoding that UTF-8, then it is displayed in the wrong way.
My suggestion is to check with your editor which encoding it is using, and tell it to use UTF-8 by default.
Open "my.ini" in "C:\xampp\mysql\bin\" directory.
Remove comment tag '#' from following code
init-connect=\'SET NAMES utf8\'
collation_server=utf8_unicode_ci
character_set_server=utf8
skip-character-set-client-handshake
character_sets-dir="C:/xampp/mysql/share/charsets"
It's Work for me
The PHP file was in ANSI format. I changed it to UTF-8 and everything started working. I did not change any code.
I add to my.ini config file xampp and resolve
[mysqld]
character-set-server = utf8
delete this line in file mysql/bin/my.ini
character-set-server=utf8mb4
collation-server=utf8mb4_general_ci
or change utf8mb4 to uft8
character-set-server=utf8
collation-server=utf8_general_ci

UTF-8 Character set CentOS PHP

I've a problem with the utf-8, I'm trying to show russian characters over my page, but I'm getting ???? instead of those russian characters.
I tried to modify .htaccess like AddDefaultCharset UTF-8 but didn't work.
I also observed that when I try to show characters using .html extension (no php) it works fine, but with the php file is shows ?????.
server details
php 5.3.16
centos release 6.3
I've similar problem as here
http://remository.com/forum/func,view/id,18483/catid,24/
Thanks
adding these lines in main php.ini worked for me
default_charset = "utf-8"
mbstring.internal_encoding=utf-8
mbstring.http_output=UTF-8
mbstring.encoding_translation=On
mbstring.func_overload=6

Categories