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
Related
All my files with .php extension and Cyrillic encoding that worked fine for years got messed up. Probably because of PHP server upgrade by hosting provider.
To illustrate the problem I wrote the simplest possible file which cannot have any errors:
http://reverent.org/testencoding.php
For some reason webpage defaults to unicode when viewed in a browser. If you go to view -> Text encoding and select Cyrillic(Windows) everything gets fine.
In contrast, exactly the same file with .html extension is displayed correctly right away:
http://reverent.org/testencoding.html
Any idea?
Now, I'm no expert on this, but this seriously reminds me of the exact issue I had. So.. personal experience, here goes (I'm sure this might help someone):
My issue was that my files on the server were set to windows 1251 by default instead of UTF-8, which I needed.. this caused these little beasts to appear: � in place of every symbol that wasn't just a basic letter or something like that. Coincidentally this is what your example looks like. And the encoding is the same. I fixed it by accessing the files with WinSCP and just switching the files to UTF-8 manually... ironically your file shows pretty much what I saw on my website.
There must be better ways to do this than WinSCP, but to be honest, this is the only time I've had to do this manually, so this is exactly what I clicked there (after opening the file):
You could also try to fix it with a meta tag to tell the browser which charset to use, but the files might be getting deformed the moment you save them, if their encoding is wrong.
<meta charset="utf-8">
This might not work for you, but it did work for me, so there's hope :)
Hope it helps or at least points you in the right direction :)
I just put the php.ini file with this single line 'default_charset = "windows-1251"' in the directory with the files with Cyrillic encoding. This overwrites server's php.ini which sets default charset to UTF.
Now everything is fine: http://reverent.org/ru/testencoding.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.
I'm having some problems with accentuation and special characters on my website.
The problem only occurs on my webhosting (I've another website on the same hosting account, this one with the issue is in a sub folder, and the main website works well), on local with Wamp Server everything is OK.
So, my problem is: with .php extension accents aren't showed correctly but if I only change the file extension from .php to .html every accents are OK.
Edit:
I found my problem... I changed my code editor from notepad++ to sublime text and now it works.
It's strange because it was working well with wamp and in a free webhosting but not on my main hebhosting :/
Anyway, thank you very much for your help.
header('Content-type: text/html; charset=utf-8');
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
Note that, depending on where the text comes from, you might have to check some other things too (database-connection, source-file-encoding, ...) - i've listed a lot of them in one of my answers to a similar question.
In accordance with the similar issue
Charset=utf8 not working in my PHP page
you need to use ASCII character
And is your content type correctly set?
I searched for you: you can use this: é (ascii 130)
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
I have problem with meta charset encoding. I have a Zend App which inserts the meta charset into phtml file this way:
$this->headMeta()->appendHttpEquiv('Content-Type', 'text/html; charset=UTF-8');
$this->headMeta();
In browser, the page has set the us-ascii charset. I don't know why it's happening.
Apache and PHP conf files have set charset with UTF-8 encoding.
My local server is set on Linux Mint (on VirtualBox in Windows 7). File encoding conversion doesn't change anything.
===============
The problem occured because of php5-tidy Apache module.
Take look here: How to set charset to UTF-8 in a Zend application? .Make sure your working files are saved with utf-8 encoding.