eclipse-java ee 设置文件编码格式、页面编码格式

文件编码格式

文件编码格式修改

Window-Preferences-General-Workspace

Text File encoding,默认选中“Default(GBK)”-这里修改成Other-UTF-8

 

Jsp页面编码格式

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
这是页面2
</body>
</html>

默认,jsp中charset=ISO-8859-1,pageEncoding="ISO-8859-1",<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">

此编码会导致Jsp页面在浏览器中呈现中文时乱码,我们需要在Eclipse中设置编码格式为UTF8,支持中文等多种语言,一劳永逸,以后新建jsp页面时不需要再设置编码格式。

Window-Preferences-Web-JSP Files

将默认的iso-8859-1改成中文不乱码的UTF-8

页面中文字体大小调整

eclipse中中文字体默认很小,跟英文字体不匹配,这里进行设置,让中文也看起来大小舒适。

参考来源:https://www.cnblogs.com/azhqiang/p/4026737.html

步骤如下:Window –> Preferences –> General –> Appearance –> Colors and Fonts,在“Colors and Fonts”中选择“Basic”–>”Text Font”,然后点“Edit”,此时只需要把“大小”里面的值编辑成“小五”即可。然后点“确定”,再点“Apply”,“OK”

发布了26 篇原创文章 · 获赞 6 · 访问量 13万+

猜你喜欢

转载自blog.csdn.net/wangdonghao137/article/details/85039296