[Discuss] Please help with a PHP and/or Apache2 problem

Alex Pennace alex at pennace.org
Sun Feb 7 13:13:43 EST 2021


On Sun, Feb 07, 2021 at 12:47:11PM -0500, Bill Horne wrote:
> Thanks for reading this. I appreciate your time.
> 
> I'm the moderator of The Telecom Digest <http://telecom-digest.org/>, and I
> publish an archive of the Digest's back issues.
> 
> I've noticed a problem with the archive: the Digest uses the ISO-8859-1
> character set, but somehow the archives aren't using it, at least in my
> Chrome browser Version 88.0.4324.150 under W10.
> 
> Please compare the result you get from both of these URL's ...
> 
> http://telecom-digest.org/archives/back.issues/recent.single.issues/a2.php
> <http://telecom-digest.org/archives/back.issues/recent.single.issues/a2.php>
> 
> http://telecom-digest.org/archives/back.issues/recent.single.issues/V40-38
> <http://telecom-digest.org/archives/back.issues/recent.single.issues/V40-38>
> 
> The first URL shows today's Digest, with some question marks in place of
> accented characters. The second appears to be normal.
> 
> The "a2.php" file is a stripped-down version of our usual archive retrieval
> code. It is shown below.
> 
> > <?php
> > include "[redacted]/archives/back.issues/recent.single.issues/V40-38";
> > ?>
> 
> The question is "why?"  All suggestions welcome.

The telecom-digest.org web server sends back the following header for the
a2.php URL:

alex at buick:~$ GET -ed http://telecom-digest.org/archives/back.issues/recent.single.issues/a2.php
200 OK
Connection: close
Date: Sun, 07 Feb 2021 18:10:39 GMT
Server: Apache/2.4.18 (Ubuntu)
Vary: Accept-Encoding
Content-Length: 5705
Content-Type: text/html; charset=UTF-8
Client-Date: Sun, 07 Feb 2021 18:10:39 GMT
Client-Peer: 128.31.0.70:80
Client-Response-Num: 1
Title: The Telecom Digest

alex at buick:~$

The "charset=UTF-8" part is the clue. It tells web browsers "this page is
in UTF-8." The problem is the content isn't encoded in UTF-8, it is
encoded in ISO-8859-1 (as you note).

Completely untested, but try this:

<?php
header('Content-Type: text/html; charset=ISO-8859-1');
include "[redacted]/archives/back.issues/recent.single.issues/V40-38";
?>

-- 
Alex Pennace, alex at pennace.org


More information about the Discuss mailing list