Current Position:Home > Content-type problems while using struts+tomcat+apache+mod_jk

Content-type problems while using struts+tomcat+apache+mod_jk

Update:12-10Source: network consolidation
Advertisement
Hi!
Could anyone tell me how to solve the following problem.
Struts-application works under apache + mod_jk + tomcat 3.3.1. Operating system is Linux.
It's impossible to me to make tomcat to send HTTP-answers in UTF-8.
I was trying the following:
1. Set <DecodeInterceptor defaultEncoding="UTF-8" /> in server.xml
(Has no effect. Tomcat responds with Content-Type: text/html; charset=iso-8859-1)
2. Insert <%@ page contentType="text/html; charset=utf-8"%> into each page header.
(Works fine but when struts-application gets GET/POST-data the two-bytes national characters
are comverted into "?"-symbols)
Is there any way to make tomcat 3.3.1 to send HTTP-answers in UTF-8?

The Best Answer

Advertisement
I don't know what the DecodeInterceptor does... but....
If you use number 2, you are only telling the browser what that page's output is. When you process the data, Tomcat for some reason always reads it as ISO8895-1, so you need to tell Tomcat to change it to UTF-8. You can do that by calling request.setCharacterEncoding("UTF-8"), either in the JSP page, or if you need it in a servlet, you can do that in a filter...
It's somewhat described here how to set it up...
http://www.mail-archive.com/[email protected]/msg01193.html
  • Content-type problems while using struts+tomcat+apache+mod_jk Update:12-10

    Hi! Could anyone tell me how to solve the following problem. Struts-application works under apache + mod_jk + tomcat 3.3.1. Operating system is Linux. It's impossible to me to make tomcat to send HTTP-answers in UTF-8. I was trying the following: 1.

  • Extended Content type problem Update:11-30

    Extended Content type problem I want to extend the content type 'ExtendDocument' from 'Document'. So I use 'Oracle Internet File System Manager' to create a new Class Object named 'EXTENDDOCUMENT', which is extend from 'DOCUMENT', and add a attribute

  • Content type problem for 'does not appear to be a proper arcive' Update:10-11

    Hi all, The following code will create a ZipOutputStream using ByteArrayOutputStream (not FileOutputStream) and attach the outputstream to a MIME multipart email using ByteArrayDataSource (so the file never exists physically). It works and sends the

  • Content-Type problems Update:11-30

    Hi, Can anyone tell me the difference in application/x-www-form-encoded and application/x-www-form-urlencoded content types in HTTP ? Thanks in advance!I don't know what the DecodeInterceptor does... but.... If you use number 2, you are only telling

  • Could not write value Content Type problem when installing itunes 08. help! Update:11-30

    When I tried to update itunes 08 there was an error. Instead, I uninstalled and downloaded the itunes8 setup. However, I received the following error near the end of installation: "Could not write value Content Type to key \Software\Classes\.aif. Ver

  • Content Type problem Update:11-30

    I am trying to retrieve the content type of a file. String strContentType ="";           File file = new File(fileName);           FileNameMap  fnmMime        = URLConnection.getFileNameMap ( ) ;            if ( fnmMime != null ) {             

  • Sharepoint 2013 and SSRS 2012 Integration - Report Server Content Types not displayed Update:10-11

    Hello, Everyone:   I installed SSRS 2012 on our Sharepoint 2013 application server following the step-by-step instruction from the posting below:   http://msdn.microsoft.com/en-us/library/jj219068.aspx   Everything goes well after STEP 3 is completed

  • Problem with content type Update:10-11

    Hi All, I have set the content type to text/html by using the following statement in jsp <%@page contentType=�text/html�%>And if I give out.println("<a href="aaa.do">Click here</a>"); it is showing me a link to click

  • Tomcat always generates charset in Content-Type http header !!! Update:10-11

    Dear All! I need urgent help with a problem I met with and any suggestion are very appreciated! The problem is: We are using Tomcat as a web server (and JSP engine), and we would like to use a user control written in C# 2.0 on one of our pages. I've

  • XML Parser and Content-type/encoding problem Update:10-11

    I've write a little and simple XML parser and a simple "trasformer" that recive an XML file and an XSL one and return HTML, here is the code: public static String toHTML(Document doc, String xslSource){         ByteArrayOutputStream testo = new