Topic: struts的resource文件里面的中文输出是乱码怎么解决啊? |
Print this page |
1.struts的resource文件里面的中文输出是乱码怎么解决啊? | Copy to clipboard |
Posted by: Johnny Posted on: 2003-06-26 12:19 我在资源文件里面的中文的错误信息用<html:errors/>输出都是乱码,<bean:message key="loginOK.message"/>输出也同样是乱码,大侠们怎么解决的啊? |
2.Re:struts的resource文件里面的中文输出是乱码怎么半啊? [Re: Johnny] | Copy to clipboard |
Posted by: lihongtao Posted on: 2003-06-26 12:58 http://www.cjsdn.com/post/view?bid=20&id=35931&sty=1&tpg=1&age=0 |
3.Re:struts的resource文件里面的中文输出是乱码怎么半啊? [Re: Johnny] | Copy to clipboard |
Posted by: neweagle Posted on: 2003-06-26 12:59 native2ascii -encoding gb2312 a.properties b.properties |
4.Re:struts的resource文件里面的中文输出是乱码怎么半啊? [Re: Johnny] | Copy to clipboard |
Posted by: Johnny Posted on: 2003-06-26 19:08 谢谢大家,问题解决了,不过是通过改struts源码解决的,用native2ascii太麻烦了,每次编辑了resource都要重新生成一遍 |
5.Re:struts的resource文件里面的中文输出是乱码怎么解决啊? [Re: Johnny] | Copy to clipboard |
Posted by: 灯泡 Posted on: 2003-06-28 12:21 to johnny you can post your methed to share. you will help many Pfans. |
6.Re:struts的resource文件里面的中文输出是乱码怎么解决啊? [Re: Johnny] | Copy to clipboard |
Posted by: floater Posted on: 2003-06-30 08:12 1. You may send mail to apache for bug report, since you modified the code and it might help others. 2. There is a task in ANT can do native -->unicode. |
7.Re:struts的resource文件里面的中文输出是乱码怎么解决啊? [Re: Johnny] | Copy to clipboard |
Posted by: Johnny Posted on: 2003-06-30 10:27 to floater: i don't think it's a bug of struts, if it is a bug, it's a bug of jdk(jre), there is no method to specify the encoding of a resource file when you use call Class.getResource() or Class.getResourceAsStream(). to dengpao: it's not me find this solution, i found a article somewhere mentioned it, may be just in this forum. to struts1.02, you can find org.apache.struts.util.PropertyMessageResources, goto line 290 or so, and make these changes: String sProps = props.getProperty(key); try { sProps=new String(sProps.getBytes("ISO-8859-1"),"GB2312"); } catch(Exception e) { } |
8.Re:struts的resource文件里面的中文输出是乱码怎么解决啊? [Re: Johnny] | Copy to clipboard |
Posted by: liuhey Posted on: 2003-07-24 14:39 我觉得最好的方法是采用UTF-8编码进行资源文件的编码,本身Unicode就是来解决编码方面的问题。如果采用这种方法进行编码转换,sProps.getBytes("ISO-8859-1"),"GB2312"); 不知对于象日文这样的双字节编码能行吗? |
Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1 客服电话 18559299278 客服信箱 714923@qq.com 客服QQ 714923 |