1.html 亂碼
1 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
2.jsp 亂碼
頁面開頭加入
<%@ page language="java" import="java.util.*" contentType ="text/html; charset=utf-8" pageEncoding="utf-8"%>
3.xmlHttpRequest 亂碼
<%@ page contentType ="text/html;charset=GBK"%>
4.Servlet 亂碼
在方法中 加入這兩句
request.setCharacterEncoding("utf-8");
response.setContentType("text/html;charset=utf-8");
5.中文注釋亂碼
原因:Eclipse中對Text file encoding的默認編碼是GBK
解決:
Eclipse->右擊"工程",將Info中的"Text file encoding"中的Other改為UTF-8
MyEclipse ->pro -> Text file encoding ->Other utf-8
轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/25029.html
標籤:JavaScript
上一篇:JS實體-01
