Re: Http_output




"Taras_96" <taras.di@xxxxxxxxx> wrote in message
news:1169691534.324946.170590@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx


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


.



Relevant Pages

  • RE: [PHP] Convert UTF-8 to windows-874?
    ... [PHP] Convert UTF-8 to windows-874? ... I think that the iconv function/package may have what you are looking ... same thing as an OSS encoding of another name. ...
    (php.general)
  • Re: utf-8 data
    ... Create the tables in the database to store the TEXT as UTF-8. ... Deliver your HTML documents in UTF-8 encoding by setting the right headers in PHP (Header, not META tag, allthough it is wise to set the META tag too. ...
    (comp.lang.php)
  • Re: mail() problem
    ... Human users use normal mail programs that can send HTML messages ... your problem seems to be due to incorrect encoding. ... > base64, but i think that's different than using quoted-printable encoding. ... PHP Classes - Free ready to use OOP components written in PHP ...
    (alt.php)
  • Re: protecting my script from being shared
    ... The Zend Encoder produced an encrypted bytecode that can't be ... and not in the OpenSource PHP engine. ... There is true encoding, even in the trivial systems, but the point to ...
    (comp.lang.php)
  • Re: Http_output
    ... individual functions that allow you to format data in a variety of formats ... from utf-8 to base 64, ... what I was trying to get at (it's from the PHP website): ... encoding you specify by mb_internal_encoding*. ...
    (alt.php)