The first sentence in jsp:
<% @ Page language = "java" import = "java. SQL. *, java. util. *, "contentType =" text/HTML; charset = gb2312 "pageEncoding =" gb2312 "%>
Add in html
<Meta http-equiv = "Content-Type" content = "text/html; charset = gb2312"/>
Normally, there is no problem. .
In addition, set charset when importing js.
<Script language = JavaScript src = "regcheckdata. js" charset = "gb2312"> </script>
However, ensure that all encoding methods are consistent.
No more:
Solve js Chinese garbled characters in eclipse...
Choose "window"> "preferences"> "general"> "content types"
Open the list in the window on the right, select "JavaScript", and enter "GBK" or "GB2312" in the input box on the right of "default encoding" and click "update, open the JS file.
Thanks to me.
If no direction is provided, add a "*. js" in the "File Association" below, and specify the encoding as "GBK" or "GB2312.