如何解决服务器不支持生僻的汉字的问题

whywzf 2003-10-16 05:55:59
使用传统的gb2312,在客户端会有一些生僻的汉字显示不出来。是否要更新(扩充)服务器端的字符集?还是有其他的做法?
服务器为redhat oracle7.0 ,请各位高手帮忙。在oracle下如何更新字符集?(请给出具体做法) 哪些中文字符集涵盖的范围比较大?谢谢!
...全文
139 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
Wnyu 2003-10-17
  • 打赏
  • 举报
回复
解决办法:
第一:
1:在jsp页面加入:
<%@ page contentType="text/html; charset=gb2312" %>
2:在servlet里面:
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.setContentType("text/html; charset=gb2312");//这是重要的

3:上面的如果在不行就用如下的方法在数据入库前进行调用:
public static String UnicodeToChinese(String s){
try{
if(s==null ¦ ¦s.equals("")) return "";
String newstring=null;
newstring=new String(s.getBytes("ISO8859_1"),"gb2312");
return newstring;
}
catch(UnsupportedEncodingException e)
{
return s;
}
}

public static String ChineseToUnicode(String s){
try{
if(s==null ¦ ¦s.equals("")) return "";
String newstring=null;
newstring=new String(s.getBytes("gb2312"),"ISO8859_1");
return newstring;
}
catch(UnsupportedEncodingException e)
{
return s;
}
}
whywzf 2003-10-17
  • 打赏
  • 举报
回复
再说明一下问题:
数据库在oracle上,用sqlplus去看,无论从我的机器(XP)还是从oracle,都可以在数据库中看到该生僻汉字。通过此操作,我的结论是问题不在数据库!
也曾经改用过GBK,这时的问题是:在本机(XP)用tomcat发布,看得到;将系统原封不动的移到oracle服务器上,同样tomcat发布。两个生僻汉字显示为“??”。

请各位再帮忙想想办法,谢谢!
ps:oracle中LANG=zh_CN
glassprogrammer 2003-10-16
  • 打赏
  • 举报
回复
使用 GBK 作为 Encoding 就可以啦
Wnyu 2003-10-16
  • 打赏
  • 举报
回复
UTF8, 支持Unicode, 包括繁体, 简体, 日文, 韩文等
Oracle内涵支持UTF8字符集。
sunshine6 2003-10-16
  • 打赏
  • 举报
回复
期待中
hxzhappy 2003-10-16
  • 打赏
  • 举报
回复
看看Jdom的解决方法就全部搞定了!
wellsoon 2003-10-16
  • 打赏
  • 举报
回复

gbk

67,512

社区成员

发帖
与我相关
我的任务
社区描述
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
社区管理员
  • Java EE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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