You are here: Re: Problem with addslashes « PHP Programming Language « IT news, forums, messages
Re: Problem with addslashes

Posted by Willem Bogaerts on 02/26/07 11:37

>>> The problem is that this works fine on my internal test web-server
>>> (running under RedHat 7.3). But on my production web-server (running
>>> Fedora Core 4) it "fails". The same function create different outputs on
>>> the two servers. The data on the prod server is corrupted.
>> I don't know what you mean by corrupted. There's an awful lot of ways a
>> file can be corrupted. Can this be en encoding problem? If the
>> corruption occurs at special characters (accented characters, euro sign,
>> etc.) and you see an "A" with an accent or tilde, then you are seeing
>> utf-8 rendered as latin1 (or derivatives). If you are seeing question
>> marks, the opposite is the case.
>
> I have tested this by uploading MS Word documents to the web-server. When
> downloading the data again, the client browser (FireFox) starts MS Words.
> MS Word claims that the document is invalid.
>
> The scripts works for some Word documents, but not other. The same happens
> for PDF documents created with Open Office (reading MS Word docs and
> exporting it to pdf files).
>
> Also, I cannot understand why the data output from the addslashes is
> different on two machiens that use the same version of PHP when the input
> is the same file. It should be the same, or?
>
> One thing I have not thought about, is the character set used in the
> database. The table is created as this:
>
> DROP TABLE IF EXISTS attachments;
> CREATE TABLE attachments (
> id MEDIUMINT UNSIGNED NOT NULL AUTO_INCREMENT,
> title CHAR(32) NOT NULL,
> filetype CHAR(32) NOT NULL,
> filedata MEDIUMBLOB NOT NULL,
> PRIMARY KEY (id)
> ) ENGINE=MyISAM DEFAULT CHARACTER SET latin1 COLLATE latin1_danish_ci
> CHECKSUM=1;
>
> Perhaps I should alter the table and let it use utf-8 (ENGINE=MyISAM DEFAULT
> CHARACTER SET utf-8...)?

Before you do that (and frankly, you shouldn't, as you are dealing with
binary data), check the output of

SHOW VARIABLES LIKE '%char%'

on both MySQL servers. Is there any difference?

--
Willem Bogaerts

Application smith
Kratz B.V.
http://www.kratz.nl/

 

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

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