|
Posted by Steve on 01/25/07 04:40
"Taras_96" <taras.di@gmail.com> wrote in message
news:1169691534.324946.170590@q2g2000cwa.googlegroups.com...
> oddly put question. 'http output' is not a php function. there are
> individual functions that allow you to format data in a variety of formats
> from utf-8 to base 64, etc.. the answer to your specific question is, no.
That makes it a bit clearer. However, this next code snippet explains
what I was trying to get at (it's from the PHP website):
"Be aware that the *strings in your source files must match the
encoding you specify by mb_internal_encoding*. It appears the Parser
loads raw bytes from the file and refers to its internal encoding to
determine their actual encoding.
To demonstrate, the following outputs as espected when the /source/
file is Latin-1 encoded:
<?php
mb_internal_encoding("iso-8859-1");
mb_http_output( "UTF-8" );
ob_start("mb_output_handler");
echo "όφδ<br/>";
?>όφδ"
"
So, HTTP output as I understand it, assumes that the output it received
is in a certain encoding (indicated by the internal encoding), and
converts it to whatever output is set by the mb_http_output function,
correct?
=== gotcha now. yes, is the answer.
I admit that my original message wasn't that clear - 'if your PHP
source is stored' should have read something like 'if the output from
your PHP function is UTF-8'. So, back to my original question, if all
of PHP output was UTF-8, could I use mb_http_output and output
buffering to deliver this to the browser as UCS-2 by the following:
mb_internal_encoding("UTF-8");
mb_http_output("UCS-2");
ob_start("mb_output_handler");
=== yes, you should be able to do that. what does you callback do?
One other thing, the term 'internal encoding' is used quite often:
"If encoding is omitted, internal character encoding is used."
(http://www.php.net/manual/en/function.mb-strlen.php)
Is this simply some variable related to the mb package that indicates,
if no other encoding is specified, the encoding of the strings it
receives?
=== it means that a default encoding is assumed and is used to interpret any
string being parsed. i think you got it if i understand what you're saying
here. i just restated it to see if you feel we're on the same page.
cheers
[Back to original message]
|