JavaScript-How to solve the header ("Www-authenticate:basic realm= ' hello ') bullet box in Chinese garbled problem?

Source: Internet
Author: User
Keywords Php html shell javascript c
header('Content-type:text/html;charset=utf-8');header("WWW-Authenticate: Basic realm='你好'");header('HTTP/1.0 401 Unauthorized');

PHP by setting the header ("Www-authenticate:basic realm= ' Hello '"), to achieve Basic authentication
However, when the information of realm is entered in Chinese, garbled characters are displayed. It is not possible to set UTF-8,GBK through the header. Don't know what to do with it?

Reply content:

header('Content-type:text/html;charset=utf-8');header("WWW-Authenticate: Basic realm='你好'");header('HTTP/1.0 401 Unauthorized');

PHP by setting the header ("Www-authenticate:basic realm= ' Hello '"), to achieve Basic authentication
However, when the information of realm is entered in Chinese, garbled characters are displayed. It is not possible to set UTF-8,GBK through the header. Don't know what to do with it?

Run your code directly prompt this, is not your 浏览器编码 not set?

Firefox Basic_Auth does not seem to support Chinese. Chrome can

][1]

realm= ' Hello ' in the pop-up box is garbled, browser Firefox and Chrome are the same, encoding I have set, UTF-8,GBK are not.

Try to turn the cue message into iso-8859-1 encoding

  • 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.