Re: Base64 strange problem



In comp.lang.javascript message <1179162644.877937.92810@xxxxxxxxxxxxxxx
glegroups.com>, Mon, 14 May 2007 10:10:44, Tamir Weiss
<tamir.weiss@xxxxxxxxx> posted:
I'm trying to send a byte array (JPG image) from javascript to a
servlet for processing.
I'm using Base64 to encode the byte array in javascript, and then a
base64 decoder in the servlet to decode it.

The thing is, that even though the String has the same length on both
sides, the decoded byte array is shorter then the original one.
I've tried a couple of different implementation on both sides, with
the same results.

It is clear what your problem is; it is that you have done something
wrong.

A better description of what code you use might render possible a more
specific response. However, as you asked no question, you may not be
expecting any answer.

It's a good idea to read the newsgroup c.l.j and its FAQ. See below.

--
(c) John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v6.05 IE 6
news:comp.lang.javascript FAQ <URL:http://www.jibbering.com/faq/index.html>.
<URL:http://www.merlyn.demon.co.uk/js-index.htm> jscr maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.
.



Relevant Pages

  • Re: Base64 strange problem
    ... base64 decoder in the servlet to decode it. ... the decoded byte array is shorter then the original one. ... JavaScript does not have a "byte" value, so what do you mean by ...
    (comp.lang.javascript)
  • Base64 strange problem
    ... I'm using Base64 to encode the byte array in javascript, ... base64 decoder in the servlet to decode it. ...
    (comp.lang.javascript)
  • Re: Base64 strange problem
    ... base64 decoder in the servlet to decode it. ... the decoded byte array is shorter then the original one. ...
    (comp.lang.javascript)
  • Re: How to verify specified signature in .NET using RSA
    ... why are you converting the signed token provided as Base64 into a byte array and then back into a string and then back into a byte array again instead of converting it directly to a byte array as I suggested? ... It seems less likely to be the right way to this since the signature data is probably arbitrary binary data which would encode properly as Base64 but might not have a valid string representation in ASCII since ASCII allows a much reduced set of characters and will not deal well with unprintable values and nulls. ...
    (microsoft.public.dotnet.framework.aspnet.security)
  • Download ZIP-file with Internet Exlorer
    ... which starts in a popup-window and it just ... The Servlet still works fine. ... It still reads the file into a byte array ... HttpServletResponse response) throws ServletException, IOException { ...
    (comp.lang.java.programmer)