On Aug 10, 2005, at 7:26 AM, Andi Gutmans wrote:
We need to automatically convert the output as internally we will be storing UTF-16 which is not what you want to send to the user. The SAPI output mechanism does the conversion, I don't think it's print & echo. It will actually save people a lot of headache that this is done automatically.
That's not true, actually. 'echo' and 'print' resolve to ZEND_ECHO opcode which calls zend_print_variable(), which in turn calls zend_make_printable_zval(). Now, this last function is supposed to take a zval and turn it into a printable string, of course, which is then output using utility_functions->write_function aka php_body_write (). All that function cares about is how to output a binary string. So, if we want to bubble the conversion down to the output layer, we probably need to change the write function so that it takes a void* and a type and knows how to deal with them appropriately.
Functions like readfile() are based on streams, so by default they will be in binary mode, simply passing the data through, unless you put a filter on it or change the default context.
As far as files are concerned, the default is also to convert to the INI encoding (forgot which INI parameter), but we will supply streams which allow you to control the in/out encoding of specific files.
The filename_encoding setting is supposed to be used only for filenames, not for file contents. That is dealt with using the mechanisms that Sara implemented in the streams system.
-Andrei -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php