[Date Prev][Date Next][Thread Prev][Thread Next][Interchange by date
][Interchange by thread
]
Re: [ic] Cleaning carriage returns etc.
Assuming that you are cleaning "data which contains tabs & new lines" and
not "tab delimited data" I would just replace the tabs & new lines with html
tags with a little perl similar to:
$textareadata =~ s/\t/\ \;\ \;\ \;/g; #replace tabs (\t)
with 3 spaces
$textareadata =~ s/\n/<br>/g; #replace newline with a <br>
You may also want to replace &,<,>," & probably a few others I can't think
of. But you do need to make sure you do your replacements in the right order
or else replacing '&' with '&' will make your ' ' into
'&nbsp;'.
$textareadata =~ s/\&/\&\;/g; # replace & with &
$textareadata =~ s/\"/\"\;/g; # replace " with "
$textareadata =~ s/\t/\ \;\ \;\ \;/g; #replace tabs (\t)
with 3 spaces
$textareadata =~ s/</\<\;/g; # replace < with <
$textareadata =~ s/>/\>\;/g; # replace > with >
$textareadata =~ s/\n/<br>/g; #replace newline with a <br>
I may have escaped too many or too little characters in the above.
--
quzax
me@quzax.com
--
A KGB keyboard has no escape key.
----- Original Message -----
From: "Rene Hertell" <rene@hertell.com>
To: "Interchange-Users" <interchange-users@minivend.com>
Sent: Thursday, April 12, 2001 4:11 PM
Subject: [ic] Cleaning carriage returns etc.
Hi list,
I bumped in problems with a field that I clean from tabs, carriage returns
etc. The formatting afterwards is not really what I want when I display the
value somewhere...
Can someone help me with some tips in what way <textarea> fields should be
collected and stored (eg. tab replaced with 3 spaces etc.), in other words:
what is safe to store in a tab-delimited file and what is not, and how
should these characters be replaced/removed.
Regards, René
_______________________________________________
Interchange-users mailing list
Interchange-users@lists.akopia.com
http://lists.akopia.com/mailman/listinfo/interchange-users
_______________________________________________
Interchange-users mailing list
Interchange-users@lists.akopia.com
http://lists.akopia.com/mailman/listinfo/interchange-users