You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-user@xml.apache.org by David Wall <dw...@Yozons.com> on 2001/05/01 02:51:09 UTC

CR+LF inside strings

Using 2.1, I have a String that contains embedded CR+LF.  It's the data
accepted directly from a web form's textarea when the user hits the enter
key.

When I return that String to my Apache SOAP client, it seems like the CR is
removed.  My string's length is always shorter by the number of pairs.  Is
there something that can prevent that from happening?

Thanks,
David
Yozons Inc.


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


Re: CR+LF inside strings

Posted by Wouter Cloetens <wo...@mind.be>.
On Tue, May 01, 2001 at 04:07:21PM -0700, David Wall wrote:
> In our case, I wouldn't normally care, but the data is also digitally
> signed, so the lack of CRs causes the signature to fail.
> 
> I'm leaning towards returning the String as a byte[] (UTF-8 or ISO-8859-1
> encoded) which should base64 encode it all and preserve the CRs.  Obviously,
> I'd prefer to return a string since that's more clear.  I hope someone is
> able to figure this out in a compliant manner.

The other option would be to attach the content as a MIME attachment.
JavaMail won't touch an attachment with a Content-Type that's clearly
binary (e.g. application/octet-stream). I suspect it'll remove the CRs
on a text/* attachment. You could also escape control characters.

Of course, if your signature algorithm is run on a hash of bytes
(rather than on a string of 16-bit Unicode Java characters), then you can
essentially regard your content as being binary. SOAP wouldn't
guarantee that you're using the same character set encoding on the
client and the server end - your application only works because
(presumably) you happen to be using Apache-SOAP and the same encoding
on both ends.

So choosing to use a String may not be the right approach
to begin with here. Does that make it any less hard a pill to swallow? ;-)

bfn, Wouter

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


Re: CR+LF inside strings

Posted by Wouter Cloetens <wo...@mind.be>.
On Tue, May 01, 2001 at 04:07:21PM -0700, David Wall wrote:
> In our case, I wouldn't normally care, but the data is also digitally
> signed, so the lack of CRs causes the signature to fail.
> 
> I'm leaning towards returning the String as a byte[] (UTF-8 or ISO-8859-1
> encoded) which should base64 encode it all and preserve the CRs.  Obviously,
> I'd prefer to return a string since that's more clear.  I hope someone is
> able to figure this out in a compliant manner.

The other option would be to attach the content as a MIME attachment.
JavaMail won't touch an attachment with a Content-Type that's clearly
binary (e.g. application/octet-stream). I suspect it'll remove the CRs
on a text/* attachment. You could also escape control characters.

Of course, if your signature algorithm is run on a hash of bytes
(rather than on a string of 16-bit Unicode Java characters), then you can
essentially regard your content as being binary. SOAP wouldn't
guarantee that you're using the same character set encoding on the
client and the server end - your application only works because
(presumably) you happen to be using Apache-SOAP and the same encoding
on both ends.

So choosing to use a String may not be the right approach
to begin with here. Does that make it any less hard a pill to swallow? ;-)

bfn, Wouter

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


Re: CR+LF inside strings

Posted by David Wall <dw...@Yozons.com>.
> Hmm. Damn. I think JavaMail is the culprit here. I never thought this
would
> matter in XML, but I guess it can in the data.

In our case, I wouldn't normally care, but the data is also digitally
signed, so the lack of CRs causes the signature to fail.

> No, though there are certainly several (annoying) ways around this, I
think
> we'll have to mark this as a known issue (pending further investigation).

I'm leaning towards returning the String as a byte[] (UTF-8 or ISO-8859-1
encoded) which should base64 encode it all and preserve the CRs.  Obviously,
I'd prefer to return a string since that's more clear.  I hope someone is
able to figure this out in a compliant manner.

Thanks,
David




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


Re: CR+LF inside strings

Posted by David Wall <dw...@Yozons.com>.
> Hmm. Damn. I think JavaMail is the culprit here. I never thought this
would
> matter in XML, but I guess it can in the data.

In our case, I wouldn't normally care, but the data is also digitally
signed, so the lack of CRs causes the signature to fail.

> No, though there are certainly several (annoying) ways around this, I
think
> we'll have to mark this as a known issue (pending further investigation).

I'm leaning towards returning the String as a byte[] (UTF-8 or ISO-8859-1
encoded) which should base64 encode it all and preserve the CRs.  Obviously,
I'd prefer to return a string since that's more clear.  I hope someone is
able to figure this out in a compliant manner.

Thanks,
David




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


Re: CR+LF inside strings

Posted by Wouter Cloetens <wo...@mind.be>.
On Mon, Apr 30, 2001 at 05:51:09PM -0700, David Wall wrote:
> Using 2.1, I have a String that contains embedded CR+LF.  It's the data
> accepted directly from a web form's textarea when the user hits the enter
> key.
> 
> When I return that String to my Apache SOAP client, it seems like the CR is
> removed.  My string's length is always shorter by the number of pairs.  Is
> there something that can prevent that from happening?

Hmm. Damn. I think JavaMail is the culprit here. I never thought this would
matter in XML, but I guess it can in the data.

No, though there are certainly several (annoying) ways around this, I think
we'll have to mark this as a known issue (pending further investigation).

bfn, Wouter

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


Re: CR+LF inside strings

Posted by Wouter Cloetens <wo...@mind.be>.
On Mon, Apr 30, 2001 at 05:51:09PM -0700, David Wall wrote:
> Using 2.1, I have a String that contains embedded CR+LF.  It's the data
> accepted directly from a web form's textarea when the user hits the enter
> key.
> 
> When I return that String to my Apache SOAP client, it seems like the CR is
> removed.  My string's length is always shorter by the number of pairs.  Is
> there something that can prevent that from happening?

Hmm. Damn. I think JavaMail is the culprit here. I never thought this would
matter in XML, but I guess it can in the data.

No, though there are certainly several (annoying) ways around this, I think
we'll have to mark this as a known issue (pending further investigation).

bfn, Wouter

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