You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by jacky <ja...@hotmail.com> on 2005/01/05 03:25:17 UTC
[FileUpload] error in parsing the double-bytes characters name
lib:
FileUpload 1.0 - 24 Jun 2003
src:
FileUploadBase fu = new DiskFileUpload();
List fileItems = null;
try
{
fileItems = fu.parseRequest(request);
Iterator iter = fileItems.iterator();
FileItem fileitem = null;
while(iter.hasNext())
{
// here, item is not a file item, just a simple form field
FileItem item = (FileItem) iter.next();
String itemname = item.getString();
}
}
client: os(windowsXP sp1),encoding(gbk) browser(IE6.0)
server: os(windowsXP sp1), encoding(gbk) tomcat4.1.30
The result is correct.
client: os(windowsXP sp1),encoding(gbk) browser(IE6.0)
server: os(linux redhat7.3), encoding(ISO8859-15) tomcat4.1.30
itemname is not the correct string.
I use fu.setEncoding("ISO8859-15"), itemname is still not correct,
then i think maybe the encoding should be the same as the client's,
so i use fu.setEncoding("gbk"), itemname is still not correct.
Re: [FileUpload] error in parsing the double-bytes characters name
Posted by Martin Cooper <mf...@gmail.com>.
You probably want to use FileItem.getString(String encoding) instead
of the getString() that uses the default encoding.
--
Martin Cooper
On Wed, 5 Jan 2005 10:25:17 +0800, jacky <ja...@hotmail.com> wrote:
> lib:
> FileUpload 1.0 - 24 Jun 2003
>
> src:
> FileUploadBase fu = new DiskFileUpload();
> List fileItems = null;
> try
> {
> fileItems = fu.parseRequest(request);
> Iterator iter = fileItems.iterator();
> FileItem fileitem = null;
>
> while(iter.hasNext())
> {
> // here, item is not a file item, just a simple form field
> FileItem item = (FileItem) iter.next();
> String itemname = item.getString();
> }
> }
>
> client: os(windowsXP sp1),encoding(gbk) browser(IE6.0)
> server: os(windowsXP sp1), encoding(gbk) tomcat4.1.30
> The result is correct.
>
> client: os(windowsXP sp1),encoding(gbk) browser(IE6.0)
> server: os(linux redhat7.3), encoding(ISO8859-15) tomcat4.1.30
> itemname is not the correct string.
> I use fu.setEncoding("ISO8859-15"), itemname is still not correct,
> then i think maybe the encoding should be the same as the client's,
> so i use fu.setEncoding("gbk"), itemname is still not correct.
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org