You are here: Re: Encoding madness! « All PHP « IT news, forums, messages
Re: Encoding madness!

Posted by Stabby on 10/11/97 11:54

Thanks for the link. I had put a fix into place already though: I just
created a couple of functions - one that encodes all the strings that go
into the DB, and one that decodes them all for the browser as they come
back out. The encoder converts all the incoming data to htmlentity
format, and replaces certain entities with special strings, and the
decode does the reverse. It's obviously not great for performance, but
it doesn't make the scripts much slower than the .Net stuff we have to
do, so it's fine now!

Juliette wrote:
> J.O. Aho wrote:
>
>> 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
>
>
>
> This page may also help you to find the problem as it covers some common
> problems with character encoding :
> http://adviesenzo.nl/examples/php_mysql_charset_fix/

 

Navigation:

[Reply to this 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

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