Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What do these PHP mbstring settings do?

I'm trying to figure out exactly what these php.ini settings do. What happens when they're set to different values? When are they necessary? When are they harmful?

  • mbstring.language
  • mbstring.http_input
  • mbstring.http_output
  • mbstring.encoding_translation

As usual, the PHP manual is less than helpful.

EDIT: Just to clarify, I understand how character encodings work, and I understand how PHP's multi-byte functions differ from their single-byte counterparts. I'm looking for specifics on what the above settings do.

EDIT 2: OK, it looks like they actually do provide more documentation than just the page on runtime configuration, which just has one-line summaries. The first three of these have similarly-named functions, and there are more details on the pages that describe the function versions. I added links above.

EDIT 3: Adding a bounty. I'm looking for specific details on exactly what these settings do, especially the last three. What do they convert from and to, and when do they do it?

like image 984
JW. Avatar asked Nov 07 '09 00:11

JW.


People also ask

What does PHP Mbstring do?

Mbstring is an extension of php used to manage non-ASCII strings. Mbstring is used to convert strings to different encodings. Multibyte character encoding schemes are used to express more than 256 characters in the regular byte wise coding system.

How can I tell if Mbstring is enabled?

You can check it through phpinfo(). Search for the string "mbstring" in phpinfo page. If it is present means then mbstring is enabled or it is disabled.


1 Answers

You can change mbstring.language to whatever language you are using with. (Source)

language

; language for internal character representation.
mbstring.language = Neutral ; Set default language to neutral(UTF-8) (default)
mbstring.language = English
mbstring.language = Japanese
mbstring.language = Korean  ;For Korean market later

http_input

; http input encoding.
mbstring.http_input = pass
mbstring.http_input = auto
mbstring.http_input = UTF-8
mbstring.http_input = UTF-8, SJIS, EUC-JP

http_output

; http output encoding. mb_output_handler must be
; registered as output buffer to function
mbstring.http_output = pass
mbstring.http_output = UTF-8

encoding translation

; enable automatic encoding translation accoding to
; mbstring.internal_encoding setting. Input chars are
; converted to internal encoding by setting this to On.
; Note: Do _not_ use automatic encoding translation for
;       portable libs/applications.
mbstring.encoding_translation = On
like image 140
Ólafur Waage Avatar answered Oct 11 '22 17:10

Ólafur Waage