1

Topic: Changing output of extern.php to charset iso-8859-1

Hi,

while migrating from 1.2.2 to current 1.3.4 some weeks ago the new base encoding is now utf-8. This is fine as long i use PunBB within a fully utf-8 enviroment. Unfortunately i used to include some post tiltles with the extern.php file on a page which outputs rely on the latin encoding. So, when embedding this script in the page, the posts will display with broken characters of course.

Has anyone a clue if and how to solve this? As all database content is now delivered with utf-8 collation this seems to be impossible without disturbing the output on the actual forum pages.

Thanks in advance and greets
felic

Re: Changing output of extern.php to charset iso-8859-1

felic wrote:

Unfortunately i used to include some post tiltles with the extern.php file on a page which outputs rely on the latin encoding.

Please, describe exactly how it was included. Maybe it's possible to convert strings somewhere.

3

Re: Changing output of extern.php to charset iso-8859-1

Parpalak wrote:

Please, describe exactly how it was included. Maybe it's possible to convert strings somewhere.

First thanks for your answer!

The Forum for our main project side (http://welcompose.de) is located on a subdomain (http://forum.welcompose.de).
To get a bunch of post teasers i just a php include the extern.php within the project website.

While the encoding of the forum subdomain is set to charset utf-8, the project website rely on iso-8859-1 enconding.

I played with the headers within the extern.php, but with no luck. Although i think, this is the place to edit.

Thanks again, regards
felic

Re: Changing output of extern.php to charset iso-8859-1

So, you have to wrap "include" with buffering commands and then to change the encoding.

It should be like this:

ob_start();

include ...

$output = ob_get_contents();
ob_end_clean();

echo iconv("UTF-8", "ISO-8859-1", $output);

5

Re: Changing output of extern.php to charset iso-8859-1

Parpalak wrote:

So, you have to wrap "include" with buffering commands and then to change the encoding.

It should be like this:

[...]

Brilliant. Works fine.

Thanks your for your help!

bye
felic

Re: Changing output of extern.php to charset iso-8859-1

You're welcome smile