PHP 4.0 Bug #7736 Updated: recode_file generates warning when input fh has received data from remote fh
| From: | stas@php.net | Date: | Tue, 21 Nov 2000 13:32:30 +0000 |
| Subject: | PHP 4.0 Bug #7736 Updated: recode_file generates warning when input fh has received data from remote fh | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-38814@lists.php.net to get a copy of this message | ||
ID: 7736
Updated by: stas
Reported By: zak@php.net
Status: Closed
Bug Type: Recode related
Assigned To:
Comments:
This is not a file problem, this is an us..flat recoding
problem. recode says on that:
recode: Ambiguous output in step `ISO-8859-1..ASCII-BS'.
I guess us..flat recode doesn't like CRs that are many in
Netscape's HTML. This is actually a bug - one shouldn't use
both LF and CR-LF line endings in one text. But it's not a
recode bug, I guess.
Previous Comments:
---------------------------------------------------------------------------
[2000-11-10 17:08:32] zak@php.net
I think that problem comes from the fwrite source code
( however my C skills are minimal and I have not carefully dug through the code :)
It seems that when fwrite gets data from a file handle with issock set, it in turn has issock set -
thus making recode unhappy...
(This is my blind guess. Hopefully this helps point out the problem (or at least amuses someone :).
If I get a chance, I will try to analyze the problem in more detail - however, I short on skill and
time for this kind of work.)
---------------------------------------------------------------------------
[2000-11-09 23:18:07] zak@php.net
recode_file() generates a spurious warning when the 'input' file handle has had data sent
to it from a file handle that references a remote system. Despite the warning, the recode attempt
succeeds - converting between character sets and writing the data to the 'output' file
handle
See the script below.
# Open a local file (instead of URL) and no warning is generated
$input = fopen ('http://www.netscape.com/',
'r');
$tmp = tmpfile ();
while (! feof ($input))
fwrite ($tmp, fgets ($input, 1024));
rewind ($tmp);
recode_file ('us..flat', $tmp, tmpfile ());
---------------------------------------------------------------------------
Full Bug description available at: http://bugs.php.net/?id=7736