|
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/
[Back to original message]
|