Question about entering an invalid string in the PHP prompt in Firefox browser ajax authentication username

Source: Internet
Author: User
Question about entering an invalid string in PHP prompt in Firefox browser ajax authentication username 1. IE10 is normal
2. Firefox and Alibaba Cloud travel will report an error
The following error is prompted when you enter Chinese characters.
( ! ) Notice: iconv(): Detected an illegal character in input string in D:\wamp\www\cangku\checkname.php on line 7Call Stack#TimeMemoryFunctionLocation10.0011243120{main}( )..\checkname.php:020.0087252736iconv ( )..\checkname.php:7

The seventh line is as follows:
$inputName = iconv("gbk//ignore","utf-8",$inputName); 

I was trying to use ajax to verify the existence of user names and so on. The test in the company is good. when I come back to my home, the test will go wrong. I am worried about compatibility issues, so I 'd like to ask for advice.
There is no problem with IE 11. the company's computer is a 360 browser, and there is no problem with it. it will be a problem with Firefox, and win10's built-in browser will not work either.


Reply to discussion (solution)

Really worried!

Is someone there ???? Ask

$ InputName = iconv ("gbk", "UTF-8 // ignore", $ inputName );

$ InputName = iconv ("gbk", "UTF-8 // ignore", $ inputName );


There is still an error. I will cut a picture.

In addition, this card reader exists in the database, which means that every time the pass is garbled or null, it is available.

Try this function. mb_convert_encoding ($ inputName, 'utf-8', 'gbk ')

Try this function. mb_convert_encoding ($ inputName, 'utf-8', 'gbk ')



Thank you for your help.
Output, because the character encoding is UTF-8, so no conversion is required. if the conversion is performed, an error is returned! The answer is the same as the one I found here!

Moreover, I made a huge mistake. the code I have been modifying is no longer on the server, but a source file I backed up from the company!

My days

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.