Wordpress - strange characters in wordpress website displayed for visitors

Let’s start with the output we got before the fix:

enter image description here

What happened here? My guess: a collision between the plugin W3 Total Cache and your web server LiteSpeed. I found a thread in a Drupal forum about a very similar (or the same) issue.

LiteSpeed seems not to send the appropriate HTTP headers for the compressed cache files W3TC stores. In its changelog for version W3TC says:

Fixed LiteSpeed web server support

So the issue seems to be known, and an upgrade should fix it.

If the upgrade did not help …

  • Ask your web hoster. You pay for support, and nobody knows the internals better.
  • Or add …

    AddType application/x-gzip .gz .tgz
    AddEncoding x-gzip .gz .tgz

    … to your .htaccess to see if it helps.

  • Or turn gzip compression off in W3TC. That is the last option if all the other approaches fail.

To test the results, do not rely on browser output. All browsers use different workarounds for broken compression, you cannot work with that. Use a tool like GIDZipTest to see if everything is okay.

This happened to me because I had two plugins trying to GZip compress the output. Disabling the second plugin fixed the problem.

Always specify the encoding used for an HTML or XML page. If you don't, characters in your content may be incorrectly interpreted. Look inside your header file to specify English and UTF-8 settings. Here's whats in my header:

<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-US">
<head profile="http://gmpg.org/xfn/11">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />