struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gundersen, Richard" <Richard.Gunder...@london-scottish.com>
Subject RE: Base64 & Newlines
Date Tue, 02 Sep 2008 10:08:04 GMT
Thanks Antonio

That worked a treat (actually the method I need was the
discardWhitespace method, which isn't public). But that gave me enough
of a hint to implement my own method, and now it all works. 

Cheers

Richard Gundersen
Java Developer
 
Email: richard.gundersen@london-scottish.com
Phone: 01618302398
Fax: 01618342536
London Scottish Bank plc
24 Mount Street
Manchester
M2 3LS

-----Original Message-----
From: Antonio Petrelli [mailto:antonio.petrelli@gmail.com] 
Sent: Tuesday, September 02, 2008 9:18 AM
To: Struts Users Mailing List
Subject: Re: Base64 & Newlines

2008/9/2 Gundersen, Richard <Richard.Gundersen@london-scottish.com>:
> It's a base64-encoded string, so I thought I'd be able to just pass it
> through as a request parameter, but I found out it contains newline
> chars every 64 characters (which I read is correct), so any JavaScript
I
> write etc gets all messed up because of these newlines
>
> I was wondering if Struts has any tags that I could use for handling
> this?

Try Commons Codec:
http://commons.apache.org/codec/api-release/org/apache/commons/codec/bin
ary/Base64.html#decodeBase64(byte[])
This way you obtain a series of octets (bytes). To convert it into a
string, you need to know the character set used for the character
encoding. You can use, for example, a ByteArrayInputStream and, after
that, an InputStreamReader with the correct encoding.

HTH
Antonio

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
______________________________________________________________________

As a responsible corporate citizen, London Scottish Bank plc asks you to consider the environment
before printing this email.

*** Disclaimer *** 

This electronic communication is confidential and for the exclusive use of the addressee.
It may contain private and confidential information. The information, attachments and opinions
contained in this E-mail are those of its author only and do not necessarily represent those
of London Scottish Bank PLC or any other members of the London Scottish Group. 

If you are not the intended addressee, you are prohibited from any disclosure, distribution
or further copying or use of this communication or the information in it or taking any action
in reliance on it. If you have received this communication in error please notify the Information
Security Manager at ISM@London-Scottish.com as soon as possible and delete the message from
all places in your computer where it is stored. 

We utilise virus scanning software but we cannot guarantee the security of electronic communications
and you are advised to check any attachments for viruses. We do not accept liability for any
loss resulting from any corruption or alteration of data or importation of any virus as a
result of receiving this electronic communication. 

Replies to this E-mail may be monitored for operational or business reasons. London Scottish
Bank PLC is regulated by the Financial Services Authority.


London Scottish Bank plc, Registered Office: 201 Deansgate, Manchester M3 3NW Registered Number
973008 England.

Subsidiary Companies:-

London Scottish Finance Limited, Registered Office: 201 Deansgate, Manchester M3 3NW Registered
Number 233259 England.

London Scottish Broking Limited, Registered Office: 201 Deansgate, Manchester M3 3NW Registered
Number 230110 England.

Robinson Way & Company Limited, Registered Office: 201 Deansgate, Manchester M3 3NW Registered
Number 885896 England.

______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message