Embedded newlines can also break your javascript. This is what we use: $$ref =~ s/\\/\\\\/g; $$ref =~ s/"/\\"/g; $$ref =~ s/'/\\'/g; $$ref =~ s/\r?\n/\\n/g;
~ John Williams On Sun, 12 Jul 2009, hha...@gmail.com wrote: > On 12.7.2009, at 2.44, MK wrote: > > added to ZooDemo.pm: > > sub js_esc { > > my $ref = shift; > > $$ref =~ s/'/\\'/; > > } > > This breaks if the string contains the sequence \' > > Also, you aren't doing a global substitution. Only the first > apostrophe will be escaped. This should be safer: > > $$ref =~ s/\\/\\\\/g; > $$ref =~ s/'/\\'/g; ------------------------------------------------------------------------------ Enter the BlackBerry Developer Challenge This is your chance to win up to $100,000 in prizes! For a limited time, vendors submitting new applications to BlackBerry App World(TM) will have the opportunity to enter the BlackBerry Developer Challenge. See full prize details at: http://p.sf.net/sfu/Challenge _______________________________________________ Mason-users mailing list Mason-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mason-users