---
title: "关于tomcat的中文编码问题"
author: "szhnet"
date: "2008-09-05T12:03:03Z"
tags: []
slug: "tomcat"
draft: false
lastmod: "2008-09-05T12:03:03Z"
id: 237477
url: "https://szhnet.iteye.com/blog/237477"
---

以前都是在server.xml中用URIEncoding解决编码问题。后来在论坛中看到mmwy提到了配置useBodyEncodingForURI这个参数。用过了才知道，果然还是这个方法更好，更灵活。配置useBodyEncodingForURI="true"后，tomcat会根据request.setCharacterEncoding参数对URL提交的数据和表单中GET方式提交的数据进行重新编码。