Re: Base64 strange problem



On May 14, 10:08 pm, Dr J R Stockton <j...@xxxxxxxxxxxxxxxxxx> wrote:
In comp.lang.javascript message <1179162644.877937.92...@xxxxxxxxxxxxxxx
glegroups.com>, Mon, 14 May 2007 10:10:44, Tamir Weiss
<tamir.we...@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. ?...@xxxxxxxxxxxxxxxxxx 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.

The encoding in JavaScript is done using the webtoolkit.base64 encoder
(on FireFox, but I'd imagine it would work on both).
The decoding is done using the org.apache.commons.codec library.

I'm not using any special parameters on neither sides, so I didn't
want to give any meaningless details.
I'm pretty new to all the javascript and base64 thing, so I'm
suspecting something in my HTML\Servlet is misconfigured.

If you've seen something like that, please tell me what helped you.

.



Relevant Pages

  • Re: Encrypted email - is there a specific solution?
    ... assign the byte array to the mailmsg body please? ... >, then you can encrypt ... > the data and either send it to yourself as an attachment or base64 encode it ...
    (microsoft.public.dotnet.framework.aspnet)
  • 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)
  • Encode the image of a texture with Base64
    ... Base64. ... encode it - or an array of byte. ... But Texture is not serializable - ... And how can I get an Array of byte of the image? ...
    (comp.lang.java.3d)
  • Re: how do I encode image as string
    ... If I knew this format, I could encode the image in Java, and then pass this string on. ... When I tried to store the source data in a javascript variable, and reference it, ala "javascript:timg", the image was not displayed. ... I did this to test whether the string could be passed from a java or javascript function. ... I did find a javascript example that when provided an array of bytes, it encodes it into a string for use in the HTML. ...
    (comp.lang.java.programmer)
  • 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)