If string is too short, encoding detection of mbstring might be failed, because code map of the different character encodings are overlapped. A typical solution to detect user input encoding is to use hidden input tag in the same form having longer multibyte string.
On Tue, 03 Sep 2002 19:08:03 +0900 [EMAIL PROTECTED] (Jean-Christian Imbeault) wrote: > I don't know if this is a problem with PHP or with the browsers but I am > observing different output of my PHP script depending whether I am using > IE5.5-japanese or N7-english. > > The script is: > > echo "Current encoding is: ".mb_http_output()."<BR>"; > echo "Current encoding is: ".mb_get_info("all")."<BR>"; > echo "The encoding of name is ".mb_detect_encoding($_POST["name"])."<BR>"; > mb_http_output("EUC-JP"); > > > The output for IE5.5 is: > > Current encoding is: pass > Current encoding is: Array > The encoding of name is EUC-JP > > The output for N7 is: > > Current encoding is: pass > Current encoding is: Array > The encoding of name is ASCII > > I called this script from a form where I entered one single kanji (ai, > love) in POST var name. > > When entered from Netscape PHP recognize the input as ASCII when it > should have been SJIS! > > Why? How can I fix it? > > Thanks, > > Jc > > PS The form was generated by PHP and I set the charset as follows: > > <head > <meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS"> > </head> > > Also my settings for mbstring were: > > Multibyte (Japanese) Support enabled > http input encoding translation enabled > > mbstring.detect_order: auto > mbstring.func_overload: 0 > mbstring.http_input: auto > mbstring.http_output: SJIS > mbstring.internal_encoding: EUC-JP > mbstring.substitute_character: no value > -- ----------------------------------------------------- Rui Hirokawa <[EMAIL PROTECTED]> <[EMAIL PROTECTED]> -- PHP Internationalization Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php