in reply to OT: Perl and Javascript - escaping newlines
Does JavaScript have a chr function?
will producemy $string = ... from db ...; my $jscode = $string; $jscode =~ s/(\W)/ '" + chr(' . ord($1) . ') + "' /ge; $jscode =~ s/ \+ ""//g; $jscode = qq{"$jscode"};
for"line1" + chr(13) + "line2" + chr(13)
"line1\nline2\n"
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: OT: Perl and Javascript - escaping newlines
by PodMaster (Abbot) on Feb 26, 2006 at 09:20 UTC | |
by ikegami (Patriarch) on Feb 27, 2006 at 15:59 UTC |