|
Posted by "Richard Lynch" on 10/24/05 19:02
On Mon, October 24, 2005 9:16 am, Yannick Warnier wrote:
> Le lundi 24 octobre 2005 à 14:37 +0100, Yannick Warnier a écrit :
>> Hi guys,
>>
>> For a reason that I don't really understand, my PHP install outputs
>> file
>> in UTF-8 by default.
>>
>> I would like to output files in ISO-8859-1 in certain cases. How do
>> I do
>> that?
>>
>> I have tried changing default_charset to iso-8859-1 with an
>> ini_set()
>> call, but it doesn't help. I also looked at the doc for fopen() and
>> fwrite() (the functions I am using to write my file) and to the
>> mbstring
>> module, but it looks like nothing is really coded to allow me to do
>> this.
>
> For some reason now I could write a fully ISO-8859-1 file, so I can
> guess I had been missing something. If someone has an explanation or a
> document on how the files created by PHP are encoded, I would be very
> glad. Thanks.
I think we went through this already...
PHP outputs a file. Period.
There is no inherent format, much less character set, to the file.
Whatever you are using to detect the character set of this file is
basically a badly-designed piece of software that is making up an
answer out of thin air. *
The only possible distinct in file types is PHP under versions of
Windows where "binary" and "text" files are different, and this is
determined by fopen()
http://php.net/fopen
* It may be looking inside the contents of the file, and searching
through all the bytes looking for what it thinks are valid character
combinations, and then "guessing" at what character set is used inside
the file... And that may not be a totally horrible thing to do, but
it's misleading to claim that the file is of a particular character
set.
The data within the file happens to fit into a particular character
set. With a small enough file, and a limited enough sample, there are
any number of character sets that *COULD* be valid. If the file is
"empty" what character set is it?
PHP isn't doing anything different to any file to make it be any
particular character set.
You get out of it what you put into it. That's pretty much PHP's
perspective on a file.
--
Like Music?
http://l-i-e.com/artists.htm
Navigation:
[Reply to this message]
|