servlet中用Session.getUserName()怎么是乱码啊?

goldpiece 2005-06-07 12:52:19
代码大致如下

protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws .... {
try{
NotesThread.sinitThread();
Session ss = NotesFactory.createSession( null, req );
String strUserName = session.getUserName();
System.out.println( strUserName ); //乱码
System.out.println( new String(strUserName.getBytes(), "utf-8") ); //还是乱码
} catch ( Exception e ) {
e.printStackTrace();
} finally {
NotesThread.stermThread();
}
}

弄了老半天了,无论怎么转,中文字符总是乱码:(
...全文
84 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
goldpiece 2005-06-11
  • 打赏
  • 举报
回复
gb2312/utf-8/iso8859...都试过啊:(
深圳陈建军 2005-06-07
  • 打赏
  • 举报
回复
这么转试过吗?
System.out.println( new String(strUserName.getBytes(), "gb2312") );

535

社区成员

发帖
与我相关
我的任务
社区描述
企业开发 Exchange Server
社区管理员
  • 消息协作社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧