CFM include JSP cannot display Arabic language

This may not relate to Lucee engine

The JSP file content has Arabic characters, it displays fine when directly access the JSP file.

<%@ page pageEncoding="utf-8" %>
<FONT class="PageTitle">Test Arabic</font><br><br>
<FONT class="PageTitle">امتحان</font><br><br>


But when using CFM includes that JSP file, it cannot display Arabic.

<cfprocessingdirective   pageencoding="utf-8">

<cfoutput>Arabic CFMX</cfoutput></br>

It displays -

Anyone has any idea what to look into?

JSP is not handled by the Lucee cfml servlet, thus, it’s just a comparison that is very similar to comparing the output to a .php, .aspx or whatever.

You need to verify if all the charsets you are using are in harmony along the entire flow/stream. You are probably saving your cfml templates as UTF-8 but Lucee is set to use it differently. You might need to change it in the Lucee admin.

Please see also the following similar issue here for a more detailed/comprehensive explanation:

Thank you for your reply.

But the issue seems to be Lucee related - Lucee-
Tried same testing code in Railo, it works.

As the testing code shows - The plain JSP Arabic works fine, the cfoutput Arabic works fine. It only breaks when embedding a JSP file within the CFM. I am guessing that GetPageContext.include() is doing something internally…

And thru tests, the CFM embedded JSP prints response.getCharacterEncoding() to ISO-8859-1, and that encoding is not able to be overridden by any Servlet Filters. Apparently that JSP includes happens before/internally with the default ISO-8859-1 encoding.

PS: I’ve tried configuring Lucee Administration → Charset All to UTF-8 and the issue still exists.

I’m not sure, could you please elaborate… are you trying to run a jsp file and include a JSP output into cfml?

I really don’t think that your jsp file is run by the jsp servlet. Your PageContext() is probably coming from the Lucee cfml engine, thus you are probably including that test.jsp as cfml and it’s very likely it is just outputting your jsp code as static. To be sure it is working, try adding this to your test.jsp to see its getting echoed:

<%= (new java.util.Date()).toLocaleString()%>

I’m pretty sure you won’t see anything, your browser should interpret that as an empty tag. Could you please confirm that?

Lucee and CFML works, as you can see in:

Update: now I’m understanding what you are trying to do. Sorry for not getting it right. I’ve no experience doing that. Maybe someone else more experienced in cfml and working with jsp may have an answer.

1 Like

This seems to be an existing defect that comes from Railo, and then to Lucee.
The issue is with

public static void include(PageContext pc, ServletRequest req, ServletResponse rsp, String realPath) throws ServletException, IOException {
		realPath = optimizeRealPath(pc, realPath);
		boolean inline = HttpServletResponseWrap.get();
		// print.out(rsp+":"+pc.getResponse());
		RequestDispatcher disp = getRequestDispatcher(pc, realPath);

		if (inline) {
			// RequestDispatcher disp = getRequestDispatcher(pc,realPath);
			disp.include(req, rsp);

		try {
			ByteArrayOutputStream baos = new ByteArrayOutputStream();
			HttpServletResponseWrap hsrw = new HttpServletResponseWrap(pc.getHttpServletResponse(), baos);

			// RequestDispatcher disp = getRequestDispatcher(pc,realPath);

			disp.include(req, hsrw);
			if (!hsrw.isCommitted()) hsrw.flushBuffer();
			pc.write(IOUtil.toString(baos.toByteArray(), ReqRspUtil.getCharacterEncoding(pc, hsrw)));
		finally {

The HttpServletResponseWrap basically overrides the response charset to ISO-8859-1 - always, in which case, the GetPageContext.include is always using ISO-8859-1 encoding and it is unable to be changed/reset by other configurations/processes.

This issue exists in Railo- and I think this comes along to Lucee.

1 Like

Can you file a bug?

Looks like this code needs to either access the underlying CoyoteResponse which contains the correct character encoding, but also should be defaulting to the current pageContext’s character encoding too

1 Like