Reply to Re: Encoding madness!

Your name:

Reply:


Posted by J.O. Aho on 07/25/06 03:52

Stabby wrote:
> 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):

Writable characters (<=127) in the different character setups are are in most
cases exact the same, but the extended (>=128) may have big differences.

The database should be set to support utf8, enter in the mysql client prompt:
SHOW CHARACTER SET;


> <?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 the files are saved as utf-8 and your apache is set to send out iso-8859-1
(see your apache config), then you get troubles.

http://dev.mysql.com/doc/refman/5.0/en/charset-unicode.html



//Aho

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация