LIII. Multi-Byte String Functions

Introduction





הערה :

הערה : If you use database with PHP , it is recommended that you use the same character encoding for both database and internal encoding for ease of use and better performance .

How to Enable mbstring

You must enable module with configure script .

The following configure options are related to mbstring module .

  • Enable mbstring Enable mbstring functions .



HTTP Input and Output

  • דוגמה 1 .

     
    ;
    
     
    ;
    
     
    Disable
    
     
    HTTP
    
     
    Input
    
     
    conversion
    
     
    mbstring.http_input
    
     
    =
    
     
    pass
    
    
    
    


  • הערה :



דוגמה 2 . php.ini setting example






דוגמה 3 .






Supported Character Encoding

Currently , the following character encoding is supported by mbstring Currently , the following character encoding is supported by mbstring module . Caracter encoding may be specified for mbstring functions ' encoding parameter .

הערה : " Supported character encoding " does not mean that it works as internal character code .

php.ini settings

  • mbstring.detect_order defines default character code detection order .



דוגמה 4 . php.ini setting example

 
;

 
;

 
Set

 
default

 
internal

 
encoding

 
;

 
;

 
Note

 
:




 
Make

 
sure

 
to

 
use

 
character

 
encoding

 
works

 
with

 
PHP

 
mbstring.internal_encoding

 
=

 
UTF-8

 
;

 
Set

 
internal

 
encoding

 
to

 
UTF-8

 
;

 
;

 
Set

 
default

 
HTTP

 
input

 
character

 
encoding

 
;

 
;

 
Note

 
:













דוגמה 5 . php.ini setting for EUC-JP users

 
;

 
;

 
Disable

 
Output

 
Buffering

 
output_buffering

 
=

 
Off

 
;

 
;

 
Set

 
HTTP

 
header

 
charset

 
default_charset

 
=

 
EUC-JP

 
;

 
;

 
Set

 
HTTP

 
input

 
encoding

 
conversion

 
to

 
auto

 
mbstring.http_input

 
=

 
auto

 
;

 
;

 
Convert

 
HTTP

 
output

 
to

 
EUC-JP

 
mbstring.http_output

 
=

 
EUC-JP

 
;

 
;

 
Set

 
internal

 
encoding

 
to

 
EUC-JP

 
mbstring.internal_encoding

 
=

 
EUC-JP

 
;

 
;

 
Do

 
not

 
print

 
invalid

 
characters

 
mbstring.substitute_character

 
=

 
none





דוגמה 6 . php.ini setting for SJIS users

 
;

 
;

 
Enable

 
Output

 
Buffering

 
output_buffering

 
=

 
On

 
;

 
;

 
Set

 
mb_output_handler

 
to

 
enable

 
output

 
conversion

 
output_handler

 
=

 
mb_output_handler

 
;

 
;

 
Set

 
HTTP

 
header

 
charset

 
default_charset

 
=

 
Shift_JIS

 
;

 
;

 
Set

 
http

 
input

 
encoding

 
conversion

 
to

 
auto

 
mbstring.http_input

 
=

 
auto

 
;

 
;

 
Convert

 
to

 
SJIS

 
mbstring.http_output

 
=

 
SJIS

 
;

 
;

 
Set

 
internal

 
encoding

 
to

 
EUC-JP

 
mbstring.internal_encoding

 
=

 
EUC-JP

 
;

 
;

 
Do

 
not

 
print

 
invalid

 
characters

 
mbstring.substitute_character

 
=

 
none





תוכן העניינים:
mb_convert_encoding -- Convert character encoding
mb_convert_kana -- Convert "kana" one from another ("zen-kaku" ,"han-kaku" and more)
mb_convert_variables -- Convert character code in variable(s)
mb_decode_mimeheader -- Decode string in MIME header field
mb_decode_numericentity -- Decode HTML numeric string reference to character
mb_detect_encoding -- Detect character encoding
mb_detect_order -- Set/Get character encoding detection order
mb_encode_mimeheader -- Encode string for MIME header
mb_encode_numericentity -- Encode character to HTML numeric string reference
mb_ereg -- Regular expression match with multibyte support
mb_ereg_match -- Regular expression match for multibyte string
mb_ereg_replace -- Replace regular expression with multibyte support
mb_ereg_search -- Multibyte regular expression match for predefined multibyte string
mb_ereg_search_getpos -- Returns start point for next regular expression match
mb_ereg_search_getregs -- Retrive the result from the last multibyte regular expression match
mb_ereg_search_init -- Setup string and regular expression for multibyte regular expression match
mb_ereg_search_pos -- Return position and length of matched part of multibyte regular expression for predefined multibyte string
mb_ereg_search_regs -- Returns the matched part of multibyte regular expression
mb_ereg_search_setpos -- Set start point of next regular expression match
mb_eregi -- Regular expression match ignoring case with multibyte support
mb_eregi_replace -- Replace regular expression with multibyte support ignoring case
mb_get_info -- Get internal settings of mbstring
mb_http_input -- Detect HTTP input character encoding
mb_http_output -- Set/Get HTTP output character encoding
mb_internal_encoding -- Set/Get internal character encoding
mb_language -- Set/Get current language
mb_output_handler -- Callback function converts character encoding in output buffer
mb_parse_str -- Parse GET/POST/COOKIE data and set global variable
mb_preferred_mime_name -- Get MIME charset string
mb_regex_encoding -- Returns current encoding for multibyte regex as string
mb_send_mail -- Send encoded mail.
mb_split -- Split multibyte string using regular expression
mb_strcut -- Get part of string
mb_strimwidth -- Get truncated string with specified width
mb_strlen -- Get string length
mb_strpos -- Find position of first occurrence of string in a string
mb_strrpos -- Find position of last occurrence of a string in a string
mb_strwidth -- Return width of string
mb_substitute_character -- Set/Get substitution character
mb_substr -- Get part of string