1. 程式人生 > >使用MyEclipse編寫Html5程式碼,在瀏覽器中開啟亂碼問題

使用MyEclipse編寫Html5程式碼,在瀏覽器中開啟亂碼問題

</pre><p>我使用的是MyEclipse10工具,新建了一個html5檔案,編寫程式碼如下:</p><p>login.htm</p><p><pre name="code" class="html"><!DOCTYPE html>
<html>
  <head>
    <title>登陸頁面</title>
    <meta name="keywords" content="keyword1,keyword2,keyword3">
    <meta name="description" content="this is my page">
    <meta name="content-type" content="text/html; charset=UTF-8">
    <!--<link rel="stylesheet" type="text/css" href="./styles.css">-->
  </head>
  <body>
    <!--This is my HTML page. <br>-->
    <h1>登陸操作</h1><hr>
    <form action="login_check.jsp" method="post">
    	<table border="1">
    		<tr>
				<td colspan="2">使用者登陸</td>
			</tr>
			<tr>
				<td>登陸ID:</td>
				<td><input type="text" name="id"></td>
			</tr>
			<tr>
				<td>登陸密碼:</td>
				<td><input type="password" name="password"></td>
			</tr>
			<tr>

				<td colspan="2">
					<input type="submit" value="登陸">
					<input type="reset" value="重置">
				</td>
			</tr>
    	</table>
    </form>
  </body>
</html>
然後在google瀏覽器上開啟,結果如下圖所示,中文全是亂碼:

<img src="https://img-blog.csdn.net/20151109192226804?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center" style="font-family: Arial, Helvetica, sans-serif;" alt="" />

問題的解決:

我的html程式碼中content="text/html; charset=UTF-8,將UTF-8改為GBK,就解決問題了