::EmbeddedPerl::Utils;
use warnings;
use strict;
use Exporter 'import';
use URI::Escape ();
use JSON::MaybeXS;
our @EXPORT_OK = qw(
normalize_linefeeds
uri_escape
escape_javascript
generate
$template =~ s/\r\n/\n/g;
$template =~ s/\r/\n/g;
return $template;
}
# Create a JSON encoder
my $json = JSON::MaybeXS->new(utf8 => 0, ascii => 1, allow_nonref => 1);
# Define the escape_javascr
ed $javascript;
# Encode the string as a JSON string
my $escaped = $json->encode($javascript);
# Remove the surrounding quotes added by JSON encoding
$escaped =~ s/^"(.*)"$/$1/;