8 Replies Latest reply on Jul 22, 2004 10:34 PM by Aaron Tang

    Default encoding switched to UTF-8

    Viet Master

      I have worked on that issue we had for a while. Basically when we change the response content type, at the same time the request content type must be changed to the same charset. Otherwise the textarea and textfield will not be decoded with the right content type.

      I had to change the compress filter which was not using the declared charset to encode the chars as bytes and some other things.

        • 1. Re: Default encoding switched to UTF-8
          Viet Master

          BTW I tried the chinese examples given some time ago and it works well without using XML char entities. So for these guys which had issues with that, I advise you to get a snapshot from the CVS and it should be ok now.

          • 2. Re: Default encoding switched to UTF-8
            innovate Newbie

            Cool,

            I will have a look into the code. Have you used the Filter from Struts?

            I just installed nukes at home where I have MacOS X. No problems with the encoding.

            At work, I have running Linux and there, I have problems with the encoding. Have you any idea what is different between those platforms???


            Regards,

            Cyrill

            • 3. Re: Default encoding switched to UTF-8
              Viet Master

              what kind ? usually the default encoding is different

              • 4. Re: Default encoding switched to UTF-8
                innovate Newbie

                Everythin OK under Linux :-)

                • 5. Re: Default encoding switched to UTF-8
                  jae Master

                  this does not seem to work if i click the "view" button when viewing the details about a file stored in the database.

                  also, it seems that pulling images out of the database is now broken w/ these changes. from what i can tell, it is b/c the ByteArrayOutputStream in the "Blah" class is set to null.

                  if i initalize that variable when calling getOutputStream and i build the ServletOutputStreamWrapper w/ that, everything seems to work, but i'm not sure if what i'm doing is ultimately correct.

                  here's the snippet for getOutputStream from the Blah class.

                   public ServletOutputStream getOutputStream() throws IOException
                   {
                   if (wrappedWriter != null)
                   {
                   throw new IllegalStateException();
                   }
                   if (wrappedStream == null)
                   {
                   OutputStream out = null;
                   if (contentType == null || exclude.contains(contentType))
                   {
                   // That means we copy the stream directly to the output
                   ServletResponse response = getResponse();
                   response.setContentType(contentType);
                   response.setBufferSize(Tools.DEFAULT_BUFFER_SIZE);
                   out = response.getOutputStream();
                   }
                   else
                   {
                   // We bufferize for compression
                   baos = new ByteArrayOutputStream();
                   }
                  
                   if (out == null)
                   {
                   wrappedStream = new ServletOutputStreamWrapper(baos);
                   }
                   else
                   {
                   wrappedStream = new ServletOutputStreamWrapper(out);
                   }
                   }
                   return wrappedStream;
                   }
                  


                  • 6. Re: Default encoding switched to UTF-8
                    Aaron Tang Newbie

                     

                    "cooper" wrote:
                    BTW I tried the chinese examples given some time ago and it works well without using XML char entities. So for these guys which had issues with that, I advise you to get a snapshot from the CVS and it should be ok now.


                    For chinese language, I just change the CoreModule's Charset attribute from "UTF-8" to "ISO-8859-1" via jmx-console, all things be ok.

                    • 7. Re: Default encoding switched to UTF-8
                      Viet Master

                      yes I spent some time to understand how these things interracts.

                      • 8. Re: Default encoding switched to UTF-8
                        Aaron Tang Newbie

                         

                        "cookman" wrote:
                        For chinese language, I just change the CoreModule's Charset attribute from "UTF-8" to "ISO-8859-1" via jmx-console, all things be ok.


                        except for the mail received from the watched forums/topics, and chinese characters that nukes saved in database are all in unicode