Hi all, I am tryign to internationalize our product and is making it UTF-8 enabled.We are working using J2EE,JSPS and IBM websphere 5.0.2 as the application server. For non enlgish content to be displayed properly I have set the content type using <%@ page contentType="text/html; charset=UTF-8" %> What we have did is put this line in a common jsp and have included common.jsp in all the other jsps This is done for the ease of changing the charset if needed just at one place With this setup my dynamic content which comes from the DataBase(which is Unicode enabled) works well. But the static content which I put in the jsp has a problem. The static non english content gets displeyd properly for only the jsps which has <%@ page contentType="text/html; charset=UTF-8" %> set in it. If this is set in some included jsp then the static content comes as junk . That is, the static content comes properly if and only if I have the line <%@ page contentType="text/html; charset=UTF-8" %> in my jsp and not in any jsp which I have included. Could anyone tell me if there is a solution to this? Note1:All Non english jsps are saved as UTF-8 Note 2:If i give META tag it works but I do not want to use META tag,'cause I want my content to be converted to UTF-8 explicity or else my dynamic content will not work.
You wrote: The static non english content gets displeyd properly for only the jsps which has <%@ page contentType="text/html; charset=UTF-8" %> set in it. If this is set in some included jsp then the static content comes as junk . Can you tell us which sort of "include" you are using to include this code? If you are using any of the "request-time" includes (<jsp:include> <c:import>, web.xml prelude etc.) this won't work. You need to make sure that you only use the "compile-time" include ( <%@include%> ) if you want to include directives.
folks, i ran into the same problem couple of days ago and i didn't find any explanation for such a behavior. why setting content type and character set has an influence only if done in the jsp file itself, and not in another included jsp file?
by the way, request.setContentType() placed in the included file works just fine. the data delivered in request is ok. but the static data is displayed right only if the page attribute is placed in the file itself, and not in the included one. [ March 22, 2006: Message edited by: Asher Tarnopolski ]
Can you smell this for me? I think this tiny ad smells like blueberry pie!
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth