HTTP Input and Output
HTTP input/output character encoding conversion may convert binary data also. Users are supposed to control character encoding conversion if binary data is used for HTTP input/output.
[!NOTE] If
enctypefor HTML form is set tomultipart/form-dataandmbstring.encoding_translationis set to On in ENTITY the POST'ed variables and the names of uploaded files will be converted to the internal character encoding as well. However, the conversion isn't applied to the query keys.
-
HTTP Input
There is no way to control HTTP input character conversion from a PHP script. To disable HTTP input character conversion, it has to be done in ENTITY.
Disable HTTP input conversion in ENTITY
;; Disable HTTP Input conversion mbstring.http_input = pass ;; Disable HTTP Input conversion mbstring.encoding_translation = OffWhen using PHP as an Apache module, it is possible to override those settings in each Virtual Host directive in ENTITY or per directory with ENTITY. Refer to the Configuration section and Apache Manual for details.
-
HTTP Output
There are several ways to enable output character encoding conversion. One is using ENTITY, another is using
ob_startwithmb_output_handleras theob_startcallback function.
ENTITY setting example
;; Enable output character encoding conversion for all PHP pages
;; Enable Output Buffering
output_buffering = On
;; Set mb_output_handler to enable output conversion
output_handler = mb_output_handler
Script example
<?php
// Enable output character encoding conversion only for this page
// Set HTTP output character encoding to SJIS
mb_http_output('SJIS');
// Start buffering and specify "mb_output_handler" as
// callback function
ob_start('mb_output_handler');
?>
谢谢你的反馈!