would also work.my $string = ... from db ...; my $jscode = $string; $jscode =~ s/(\W)/ sprintf('\\0%o', ord($1)) /ge; $jscode = qq{"$jscode"};
In reply to Re^3: OT: Perl and Javascript - escaping newlines
by ikegami
in thread OT: Perl and Javascript - escaping newlines
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |