For Programmers: Free Programming Magazines  


Home > Archive > PHP Language > March 2006 > Character encoding problems (command line vs browser)









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Character encoding problems (command line vs browser)
miken32

2006-03-30, 6:57 pm

I've got a table in MySql (table, database, server, and connection all
using iso-8859-1) with some accented characters. When I try to display
these in a web browser, they come out incorrectly. But running PHP
from the command line I have no such problems. I also see the accents
correctly from the MySql client.

There is no HTML issue, because I've reverted to text/plain for the
purposes of troubleshooting. I'm not sure how this will come out for
those of you using text-only newsreaders, but this is what I'm seeing:

Command Line:
ALL=C9E All=E9e
=CELE =CEle
=C9CH =C9changeur

Browser:
ALL=90E All,e
=D7LE =D7le
=90CH =90changeur

This is the code, nothing more than a straight database dump:
<?php
$link=3Dnew mysqli(....);
$result=3D$link->query ('select * from street_types');
header('Content-Type:text/plain');
while ($row=3D$result->fetch_row()){
echo "$row[0] $row[1]\n";
}
?>

Has anyone seen this before? Any ideas how to fix it? Thanks!

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com