weird issue with new lines

M

mladen.adamovic

'm facing one weird problem with new lines if you have some spare time
perhaps you can think about it...

Doing some string manipulation with strings and when one String
displays to stdout in Netbeans it looks like :
INFO: sortedText=ad,ds,sadas,sadsdsadasdsdda,sd

but however when I print that String to web server (Glassfish v3) it
displays in HTML with random new lines as
ad,
ds,
sadas,
sadsdsadasdsdda,sd

The same behavior with Chrome and with Firefox, however if I copy and
paste that String in Gmail it doesn't contain those new lines any
longer.

I thought it might be \r issue, but I'm using linux and
line = line.replaceAll("\r", "");
didn't solve it.


This is nothing important but I'm curious why it might happen.

Thanks.
 
R

Roedy Green

Doing some string manipulation with strings and when one String
displays to stdout in Netbeans it looks like :
INFO: sortedText=ad,ds,sadas,sadsdsadasdsdda,sd

First you must nail down precisely what hex chars are in your strings
at both ends. You might have \r \n \t etc.

See http://mindprod.com/jgloss/hex.html for some tools to dump out
your Strings in hex.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,996
Messages
2,570,238
Members
46,826
Latest member
robinsontor

Latest Threads

Top