奇怪的中文乱码问题

不知道是不是struts2的原因 应该关系不大
首先,提交的中文不是全部都乱码,只是乱码其中的一部分
比如:
提交一个姓名:陈玥颖
在后台得到这个姓名时是:陈?颖

其他某些中文字符也是这样,显示一个问号,但是有些中文字符又是正常的,感觉就像是这个字符不识别。。。。。

奇怪的问题。。。。。

请教大侠

gb2312编码是简化的,有的汉字不支持,这个改编码吧,用utf-8或者gbk都可以。
[code="java"]
System.out.println(new String("陈玥颖 ".getBytes("GBK"), "GBK"));
System.out.println(new String("陈玥颖 ".getBytes("UTF-8"), "UTF-8"));
System.out.println(new String("陈玥颖 ".getBytes("GB2312"), "GB2312"));
[/code]
gb2312确实不支持“玥”字

什么编码?gbk?gb2312?

在struts.xml配置一常量

[code="java"]<!-- 将action的字集编码统统配置成GB2312 ,解决中文乱码问题 -->

<constant name="struts.i18n.encoding" value="GB2312 " />[/code]

System.out.println(new String("陈玥颖 ".getBytes(), "GBK"));
System.out.println(new String("陈玥颖 ".getBytes(), "GB2312"));

GBK是所有汉字,包含简体和繁体。而GB2312是简体汉字,甚至有些极少用到的汉字在这个字符集里面也没有。

估计你中彩了 玥没在GB2312中,建议换成GBK/UTF-8

使用utf-8编码吧