<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Escaping Javascript in Perl</title>
	<atom:link href="http://getluky.net/2005/07/28/escaping-javascript-in-perl/feed/" rel="self" type="application/rss+xml" />
	<link>http://getluky.net/2005/07/28/escaping-javascript-in-perl/</link>
	<description></description>
	<lastBuildDate>Mon, 09 Jan 2012 10:13:49 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: SiteWizard eCommerce CMS</title>
		<link>http://getluky.net/2005/07/28/escaping-javascript-in-perl/comment-page-1/#comment-11823</link>
		<dc:creator>SiteWizard eCommerce CMS</dc:creator>
		<pubDate>Sat, 02 Sep 2006 17:21:38 +0000</pubDate>
		<guid isPermaLink="false">http://getluky.net/?p=183#comment-11823</guid>
		<description>&lt;p&gt;top work, we are implementing the FCKeditor into our CMS and needed this exact code.
Just Wanted to Say THANKS!
Richard SiteWizard Developer&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>top work, we are implementing the FCKeditor into our CMS and needed this exact code.
Just Wanted to Say THANKS!
Richard SiteWizard Developer</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Justin Simoni</title>
		<link>http://getluky.net/2005/07/28/escaping-javascript-in-perl/comment-page-1/#comment-1012</link>
		<dc:creator>Justin Simoni</dc:creator>
		<pubDate>Tue, 03 Jan 2006 05:46:52 +0000</pubDate>
		<guid isPermaLink="false">http://getluky.net/?p=183#comment-1012</guid>
		<description>&lt;p&gt;Some weirdness in the post: &lt;/p&gt;

&lt;p&gt;The sourcecode in the above example gets all whacked with the smart quotes and curly quotes and all that - if you just copy/paste the source, you&#039;ll get all sorts of errors from Perl. &lt;/p&gt;

&lt;p&gt;Secondly, spaces and tabs seem to act funky when I tried this - I&#039;m trying to escape some HTML in Perl to pass to FCKEditor which itself is being called by HTML::Template - anyways, here&#039;s what I did - after escaping the HTML, I think unescaped spaces and tabs - I bet it would be easier to do this using HTML::Entities but, meh: &lt;/p&gt;

&lt;p&gt;sub js_enc {&lt;/p&gt;

&lt;p&gt;my $str = shift &#124;&#124; &#039;&#039;;
my @chars = split(//,$str);
foreach my $c (@chars) {
$c = &#039;\x&#039; . sprintf(&quot;%x&quot;, ord($c));
}
my $e =  join(&#039;&#039;,@chars);&lt;/p&gt;

&lt;p&gt;$e =~ s/&#092;xa/ /g;
$e =~ s/&#092;x9/\t/g;
return $e; &lt;/p&gt;

&lt;p&gt;}&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Some weirdness in the post: </p>

<p>The sourcecode in the above example gets all whacked with the smart quotes and curly quotes and all that &#8211; if you just copy/paste the source, you&#8217;ll get all sorts of errors from Perl. </p>

<p>Secondly, spaces and tabs seem to act funky when I tried this &#8211; I&#8217;m trying to escape some HTML in Perl to pass to FCKEditor which itself is being called by HTML::Template &#8211; anyways, here&#8217;s what I did &#8211; after escaping the HTML, I think unescaped spaces and tabs &#8211; I bet it would be easier to do this using HTML::Entities but, meh: </p>

<p>sub js_enc {</p>

<p>my $str = shift || &#8221;;
my @chars = split(//,$str);
foreach my $c (@chars) {
$c = &#8216;\x&#8217; . sprintf(&#8220;%x&#8221;, ord($c));
}
my $e =  join(&#8221;,@chars);</p>

<p>$e =~ s/&#92;xa/ /g;
$e =~ s/&#92;x9/\t/g;
return $e; </p>

<p>}</p>]]></content:encoded>
	</item>
</channel>
</rss>

