html5 文件未正确显示土耳其语字符

html5 file doesn't show turkish characters as properly

我在 html5 上遇到了 turkişh 字符的问题。我在网上调查了同样的问题并应用了解决方案,但它不起作用。我分享我的代码。你能帮帮我吗?

这是我的 allemployees.html 文件:

<!DOCTYPE html>
<html lang="tr">
<head>
<meta charset="UTF-8">
<link href="<c:url value="../resources/css/bootstrap.css" />"    rel="stylesheet">
<link href="<c:url value="../resources/css/bootstrap-theme.css" />" rel="stylesheet">
</head>
<body>
<div class="table-responsive">
<h2>Tüm Çalışanlar</h2>
<table class="table table-bordered">
<div class="row">
<div class="col-md-12">
<tr>
<td class="field-label col-xs-3 active">
<label>TC No</label>
</td>
<td class="field-label col-xs-3 active">
<label>Ad</label>
</td>
<td class="field-label col-xs-3 active">
<label>Soyad</label>
</td>
<td class="field-label col-xs-3 active">
<label>Başlama Tarihi</label>
</td>
<td class="field-label col-xs-3 active">
<label>Maaş</label>
</td>
</tr>
</div>
</div>
<c:forEach items="$(allEmployees)" var="employee">
<tr>
<div class="row">
<div class="col-md-12">
<td>$(employee.citizenNumber)</td>
<td>$(employee.name)</td>
<td>$(employee.surname)</td>
<td>$(employee.joiningDate)</td>
<td>$(employee.salary)</td>
<td>
<a href="<c:url value='/edit-${employee.oid}-employee' />">${employee.oid}</a>
</td>
<td>
<a href="<c:url value='/delete-${employee.oid}-employee' />">delete</a>
</td>
</div>
</div>
</tr>
</c:forEach>
</table>
</div>
<br/>
<a href="<c:url value='/new' />">Yeni Çalışan</a>
</body>
</html>

这是我的 jsp 文件(我包括 html):

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ include file="../templates/allemployees.html" %>

您可以在 JSTL 核心库中使用 importcharEncoding 属性。

<c:import url="../templates/allemployees.html" charEncoding="UTF-8" />

编辑

如果你把html个文件放入WEB-INF/templates那么你应该使用映射

xml:

<mvc:resources mapping="/templates/**" location="/WEB-INF/templates/"  />

注解: Config中添加addResourceHandlers方法class

@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
   registry.addResourceHandler("/templates/**").addResourceLocations("/WEB-INF/templates/");
}

因此,您可以像这样访问 WEB-INF 文件夹中的 html 文件:

<c:import url="/templates/allemployees.html" charEncoding="UTF-8" />