Encoding madness!
- From: Stabby <stabby@xxxxxxxxxxxxx>
- Date: Mon, 24 Jul 2006 23:22:22 +0100
Using PHP 5.1.4 with MySQL 5.0.18 on a dev machine. Doesn't seem to matter what I do, character encoding is screwed on this server. It's ok with normal chars, but "extended" chars like the pound sign (£) are corrupted when sent to the DB from a form then back to the browser from the DB. I'm setting the following headers on the top of every page (using an include, so I'm certain it's always in there):
<?xml version="1.0" encoding="utf-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr">
Also using header("Content-type: text/html; charset=ISO-8859-1"); in the include file for good measure. PHP scripts are being saved in UTF8 encoding. Server is running Linux.
If I print the data back out to the browser (selected from the DB) in place of the pound sign, I just get A£ (with an accent over the A). Bizarrely, phpmyadmin displays a pound sign correctly when viewing the rows in the table, so I assume there's some conversion going on there (probably converting accent+pound to pound or something).
It seems like the data is getting into the DB ok, but PHP is corrupting it as it comes out again.
.
- Follow-Ups:
- Re: Encoding madness!
- From: J.O. Aho
- Re: Encoding madness!
- Prev by Date: webbot
- Next by Date: Forums
- Previous by thread: webbot
- Next by thread: Re: Encoding madness!
- Index(es):
Relevant Pages
|