为了账号安全,请及时绑定邮箱和手机立即绑定

如何使用 XPAGES DesignerFacesServlet 显示泰语字母

如何使用 XPAGES DesignerFacesServlet 显示泰语字母

慕勒3428872 2022-11-02 10:12:47
我尝试创建 XSP Servlet 并希望在我的 Web 应用程序中完全支持泰语(和/或其他亚洲/阿拉伯字母)。此脚本是来自https://frostillic.us/blog/posts/159496067A27FD3585257A70005E7BC1的自定义版本环境:Domino 9.0.1 FP6,Windows Server 2008package com.testing.servlet;import java.io.*;import java.util.*;import com.ibm.commons.util.StringUtil;import com.ibm.xsp.webapp.DesignerFacesServlet;import javax.faces.context.FacesContext;import javax.servlet.*;import javax.servlet.http.*;import lotus.domino.*;public class Testing extends DesignerFacesServlet {    //Session    private static Session getCurrentSession(FacesContext context) {        return (Session) context.getApplication().getVariableResolver()                .resolveVariable(context, "session");    }    private void incinerate(Object... dominoObjects) {        for (Object dominoObject : dominoObjects) {            if (null != dominoObject) {                if (dominoObject instanceof Base) {                    try {                        ((Base)dominoObject).recycle();                    } catch (NotesException e) {                        System.out.println("[FAILED TO RECYCLE]");                        e.printStackTrace();                    }                }            }        }    }    public void service(ServletRequest servletRequest, ServletResponse servletResponse) throws ServletException, IOException {        HttpServletRequest req = (HttpServletRequest)servletRequest;        HttpServletResponse res = (HttpServletResponse)servletResponse;        ServletOutputStream out = res.getOutputStream();        FacesContext facesContext = this.getFacesContext(req, res);        Session session = null;        Database database = null;        View view = null;        Document doc = null;            }        }    }}结果startCounter: 5???????????? // thai letter display as ????done如何显示泰文而不是????
查看完整描述

1 回答

?
Smart猫小萌

TA贡献1911条经验 获得超7个赞

在处理挪威字符时,我遇到了类似的问题。能够通过切换到 aPrintWriter而不是来修复它ServletOutputStream:


HttpServletResponse res = (HttpServletResponse) servletResponse;

HttpServletRequest req = (HttpServletRequest) servletRequest;


res.setContentType("application/json; charset=UTF-8;");


//use a PrintWriter here, since we also have to deal with UTF-8 characters

PrintWriter out = res.getWriter();

刚刚对泰语和阿拉伯语进行了快速测试,这似乎有效。


查看完整回答
反对 回复 2022-11-02
  • 1 回答
  • 0 关注
  • 79 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信