strange characters in wordpress website displayed for visitors [closed]

Apparently a lot of people complain that they only see random letters and characters:

enter image description here

My biggest problem is that I can’t reproduce the problem on ANY of my devices!
Not on my Windows XP laptop, not on my Windows 7 laptop, not on my Android phone or my iPod Touch. It doesn’t matter which browser I’m using.
The only time I see the problem myself is when I try to share one of my blog posts on Google+, because the blog description then appears in strange characters.

So, first of all I need to find a way to reproduce the problem somehow.
Otherwise I won’t be able to see if what I did fixed the problem or not.

I did everything that @toscho recommended, but nothing helped.

Did anybody ever run into a similar problem or would you know where I could start to look for the problem?

Edit: I contacted my webhost. They couldn’t reproduce the problem, just like me.
They said that they have enabled gzip compression on their servers. They suggested turning off one plugin after another to see what happens, but as I can’t reproduce the problem, I can’t do that. Please help!

More and more readers are complaining about this problem. Most of them just need to refresh the page or wait a few minutes and then the site loads normally, but I’m still using a lot of traffic because of that.

EDIT 2: The W3 Total Cache Plugin FAQ says:
I see garbage characters instead of the normal web site, what’s going on here?

If a theme or it’s files use the call php_flush() or function flush() that will interfere with the plugins normal operation; making the plugin send cached files before essential operations have finished. The flush() call is no longer necessary and should be removed.

I am pretty sure that none of my code has this call anywhere, but I’m not 100% sure.
Is there any way to find out other than searching through millions of characters in all of my files?

3 Answers
3

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 0.9.2.4 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.

Leave a Comment