Re: [enhydra] Problem with UTF-8 and POST method in EE 6.3

Lofi Dewanto <[email protected]> Wed, 31 Aug 2005 23:21:28 +0200
Newsgroups gmane.comp.java.enhydra.general
Message-ID <[email protected]>
This is a multi-part message in MIME format...

------------=_1125523279-10599-290
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 8bit

Hi João,

thanks a lot for your help. It works now!
Here is a small update....

 > 2) Where do you get this constant?
 > HttpUtils.ENCODING
 > I cannot find it...
 >
 > JPR - javax.servlet.http.HttpUtils

javax.servlet.http.HttpUtils is already deprecated.
Instead you can use:

comms.request.getHttpServletRequest()
     .getCharacterEncoding();

So this is the function (for others who might need
this...)

private String parseValuePart(MultipartMimeInputStream part)
			throws IOException {
   charEncoding = comms.request.getHttpServletRequest()
     .getCharacterEncoding();
   byte[] buffer = new byte[2048];
   StringBuffer sb = new StringBuffer(2048);
   int n = 0;
   while ((n = part.read(buffer, 0, buffer.length)) != -1) {
     sb.append(new String(buffer, 0, n, charEncoding));
   }
   return sb.toString();
}

Cheers,
-- 
---------------------------------------------------
Blasius Lofi Dewanto
---------------------------------------------------
OpenUSS - Open University Support System
http://openuss.sourceforge.net
---------------------------------------------------
E-Mail   : [email protected]
---------------------------------------------------



------------=_1125523279-10599-290
Content-Type: text/plain; name="message-footer.txt"
Content-Disposition: inline; filename="message-footer.txt"
Content-Transfer-Encoding: 8bit


--
You receive this message as a subscriber of the [email protected] mailing list.
To unsubscribe: mailto:[email protected]
For general help: mailto:[email protected]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws

------------=_1125523279-10599-290--