Character encoding problems (command line vs browser)

This is a discussion on Character encoding problems (command line vs browser) within the alt.comp.lang.php forums, part of the PHP Programming Forums category; I've got a table in MySql (table, database, server, and connection all using iso-8859-1) with some accented ...


Go Back   Usenet Forums > PHP Programming Forums > alt.comp.lang.php

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 03-30-2006
miken32
 
Posts: n/a
Default Character encoding problems (command line vs browser)

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ÉE Allée
ÎLE Île
ÉCH Échangeur

Browser:
ALLE All,e
×LE ×le
CH changeur

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

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

Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 11:05 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0