-
1. Re: Stream decoding UFT-8
jonlee Aug 11, 2003 4:45 PM (in response to as280286)I'm not sure if this will solve all your issues but isn't it supposed to be UTF-8?
-
2. Re: Stream decoding UFT-8
as280286 Aug 13, 2003 4:49 AM (in response to as280286)You are right.
In fact, i think that the String included in the POST is x-www-form-urlencoded, that's why i get special characters.
But i'm not sure, because when
How can i retrieve my characters starting from this String ? -
3. Re: Stream decoding UFT-8
jonlee Aug 13, 2003 5:59 AM (in response to as280286)You'll need to determine how the data is being passed. I'd have a suspicion it is being passed as a multi-part/form data and the easiest way to deal with it is to use helper classes from either Smartupload from JspSmart or from STRUTS and then work to process the uploaded "file" stream.
Otherwise, as a name-value pair, you would just create a new string from the old one but for the UTF-8 encoding.
This assumes that you are processing data from a POST action. -
4. Re: Stream decoding UFT-8
as280286 Aug 13, 2003 3:55 PM (in response to as280286)I've found a code who works well :
StringBuffer mXMLLine = new StringBuffer();
String line = null;
String strResult ='';
InputStreamReader insr = new InputStreamReader (request.getInputStream(),"UTF8");
BufferedReader in = new BufferedReader(insr);
while (null != (line = in.readLine()))
{
mXMLLine.append(line);
}
strResult = mXMLLine.toString();
The string i get after (strResult) is well encoded (ASCII) and my accents are OK.
I've tryed with "UFT-8" but not "UTF8"
and the idea came from this (very well done !) link :
http://java.sun.com/docs/books/tutorial/i18n/text/stream.html.
If think it will be very important to know for people using FlashMX (i look at the query mode : it's a real POST).
Thank you for your help,
Olivier.