O'Reilly Upload Package Issue

Discussion in 'Java' started by sentzm@gmail.com, Aug 8, 2006.

  1. Guest

    I am using O'Reilly's upload package for html form based uploading and
    I came across an issue when I upload text files. The files are uploaded
    sucessfully, but when I access the file through a link, such as
    www.[domainname].com/uploads/testfile.txt the file is displayed in
    binary:

    Ž€€ÃÍ>ÄÈÑ?>€ÇÑÀÁË€ÈÇÁ€
    øøÊ?Î/%€åÊ?Íø€Á_/Ñ%€ÄÇÁÄ,Â?Ì€ÃÊ?_€ÈÇÁ€Ã?Ê

    How do I get text files to be displayed I guess in ASCII (plain
    english!?!) so when the file is accessed through a web browser it
    would display:

    "This is a text file" and not the binary string shown above.

    I noticed that in one of the MultipartRequest constructors in
    O'Reilly's package, there is a String encoding argument. This might be
    the answer to my question, but I am not exactly sure what the econding
    String code should be.

    Any ideas??
     
    , Aug 8, 2006
    #1
    1. Advertising

  2. Chris Uppal Guest

    wrote:

    > Z??ÃÍ>ÄÈÑ?>?ÇÑÀÁË?ÈÇÁ?
    > øøÊ?Î/%?åÊ?Íø?Á_/Ñ%?ÄÇÁÄ,Â?Ì?ÃÊ?_?ÈÇÁ?Ã?Ê


    I can't think of any plausible combination of charset encoding problems which
    would turn more-or-less pure ASCII English text into that kind of gibberish. I
    suspect that the problem may be caused by some kind of confusion between client
    and server over the use of compression, but that's just a guess. As in all
    such cases, the /first/ thing to do is get hold of a copy of Ethereal (free)
    and see what the client is really sending to the server and what the server is
    really sending back.

    -- chris
     
    Chris Uppal, Aug 8, 2006
    #2
    1. Advertising

  3. wrote:
    > I am using O'Reilly's upload package for html form based uploading and
    > I came across an issue when I upload text files. The files are uploaded
    > sucessfully, but when I access the file through a link, such as
    > www.[domainname].com/uploads/testfile.txt the file is displayed in
    > binary:
    >
    > Ž€€ÃÍ>ÄÈÑ?>€ÇÑÀÁË€ÈÇÁ€
    > øøÊ?Î/%€åÊ?Íø€Á_/Ñ%€ÄÇÁÄ,Â?Ì€ÃÊ?_€ÈÇÁ€Ã?Ê
    >
    > How do I get text files to be displayed I guess in ASCII (plain
    > english!?!) so when the file is accessed through a web browser it
    > would display:
    >
    > "This is a text file" and not the binary string shown above.
    >
    > I noticed that in one of the MultipartRequest constructors in
    > O'Reilly's package, there is a String encoding argument. This might be
    > the answer to my question, but I am not exactly sure what the econding
    > String code should be.
    >
    > Any ideas??
    >


    I don't understand. If the files are uploaded successfully then it's not
    a problem with the package. First check that the files are really
    uploaded successfully.
    That said, are you sure it's normal ascii and not unicode, or something
    like that? If it is unicode I think that the encoding should help.
    As a last question: why are you using the O'Reilly's package? Maybe you
    should consider the Jakarta commons file upload, which has less license
    problems and it's probably more used:

    http://jakarta.apache.org/commons/fileupload/
     
    Andrea Desole, Aug 8, 2006
    #3
  4. Guest

    Andrea Desole wrote:
    > wrote:
    > > I am using O'Reilly's upload package for html form based uploading and
    > > I came across an issue when I upload text files. The files are uploaded
    > > sucessfully, but when I access the file through a link, such as
    > > www.[domainname].com/uploads/testfile.txt the file is displayed in
    > > binary:
    > >
    > > Ž€€ÃÍ>ÄÈÑ?>€ÇÑÀÁË€ÈÇÁ€
    > > øøÊ?Î/%€åÊ?Íø€Á_/Ñ%€ÄÇÁÄ,Â?Ì€ÃÊ?_€ÈÇÁ€Ã?Ê
    > >
    > > How do I get text files to be displayed I guess in ASCII (plain
    > > english!?!) so when the file is accessed through a web browser it
    > > would display:
    > >
    > > "This is a text file" and not the binary string shown above.
    > >
    > > I noticed that in one of the MultipartRequest constructors in
    > > O'Reilly's package, there is a String encoding argument. This might be
    > > the answer to my question, but I am not exactly sure what the econding
    > > String code should be.
    > >
    > > Any ideas??
    > >

    >
    > I don't understand. If the files are uploaded successfully then it's not
    > a problem with the package. First check that the files are really
    > uploaded successfully.
    > That said, are you sure it's normal ascii and not unicode, or something
    > like that? If it is unicode I think that the encoding should help.
    > As a last question: why are you using the O'Reilly's package? Maybe you
    > should consider the Jakarta commons file upload, which has less license
    > problems and it's probably more used:
    >
    > http://jakarta.apache.org/commons/fileupload/


    The files are definitely uploaded successfully. When I try to access
    the text file through the URL, instead of giving me the text file in
    "plain english:" it gives me the file contents in that gibberish. I am
    using this package because it was the decision of the IT shop to use it
    rather than the Jakarta Struts upload. My initial throughts is it has
    to do something with the encoding or something along those lines.
     
    , Aug 8, 2006
    #4
  5. wrote:

    > The files are definitely uploaded successfully. When I try to access
    > the text file through the URL, instead of giving me the text file in
    > "plain english:" it gives me the file contents in that gibberish. I am
    > using this package because it was the decision of the IT shop to use it
    > rather than the Jakarta Struts upload. My initial throughts is it has
    > to do something with the encoding or something along those lines.


    If you can open it with an editor and see its content I'm not sure it's
    a package's fault. An ascii file doesn't have special properties. To be
    sure you can make a file by yourself and see what happens. You can also
    try to open the file from the browser as a normal file, without going
    through the server.
    You can look at the encoding, but I would rather look at the character
    encoding, instead of the content encoding. Try to set the content type
    header to something like "text/plain; charset=iso-8859-1". I'm not able
    to go much further; if you want to know more I suggest to ask an http
    newsgroup.
    If you are using IE6 you can also try another browser. Apparently there
    are some problems with the text/plain header. I just found this by accident:

    http://support.microsoft.com/default.aspx?scid=kb;en-us;329661

    In the worst case I would follow Chris' suggestion. Maybe Ethereal is a
    bit low level for what you need, but you should check at least the
    response headers coming from the server.
     
    Andrea Desole, Aug 9, 2006
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jesse Liberty
    Replies:
    2
    Views:
    334
  2. sauzer
    Replies:
    1
    Views:
    996
    Teemu Keiski
    Jun 17, 2005
  3. sal
    Replies:
    0
    Views:
    392
  4. Moritz Beller

    O'Reilly book: Mastering algorithms with C

    Moritz Beller, Jun 4, 2004, in forum: C Programming
    Replies:
    7
    Views:
    1,429
    CBFalconer
    Jun 7, 2004
  5. Ron Stephens

    Learning Python, 2'nd Edition, O'Reilly

    Ron Stephens, Sep 11, 2003, in forum: Python
    Replies:
    3
    Views:
    309
    Ron Stephens
    Sep 12, 2003
Loading...

Share This Page