charset=iso-8859-2 webpage displays with UTF-8 header - question marks (�) instead of accented letters

Solution 1:

The server’s HTTP headers say

Content-Type: text/html; charset=UTF-8

which browsers would probably consider more trustworthy than what’s inside the file. Why not just use UTF-8? It’s an established encoding on all platforms.

Also, there’s garbage text before the HTML declaration:

[M _2<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

Solution 2:

After a lot of searching I managed to find the right solution. My thanks fly out @Daniel B, for pointing me to the right direction. :)

It seems, that due to the upgrade, the apache2 engine processes all Content-Type "text/html files with UTF-8 charset, disregarding the <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2" /> statement in the actual html / php files. I am not sure why this supposed to be a good thing (please explain if you can). Nevertheless the solution for getting rid of the question mark characters (ďż˝) was the following:

The Solution: I added the below line to the VirtualHost apache2 definition of my website in /etc/apache2/sites-available/MySiteName.conf than I reloaded the server configs with the service apache2 reload command. After this the files are served with proper Content-Type: text/html; charset=iso-8859-2 character encoding header.

<VirtualHost * >

# [...Some other configurations before this line]

    #To fix encoding problem, that pages display with UTF-8 header though they are created with iso-8859-2 encoding - giny8i8 2015-12-03
    Header set Content-Type "text/html; charset=iso-8859-2"
        # Source:  http://superuser.com/questions/1008480/charset-iso-8859-2-webpage-displays-with-utf-8-header-question-marks-inste/1008482?noredirect=1#comment1397150_1008482

</VirtualHost>

Let me know if this works for you too, if you encounter the same challange after a Debian 8.0 Jessie upgrade! I searched for this on the internet, but did not find it spelled out like this. Hence my answer post.

Solution 3:

here is solution:

/etc/httpd/conf/httpd.conf:

# Specify a default charset for all content served; this enables
# interpretation of all content as UTF-8 by default.  To use the
# default browser choice (ISO-8859-1), or to allow the META tags
# in HTML content to override this choice, comment out this
# directive:
#
#AddDefaultCharset UTF-8