Right, you actually need to encode your Javascript first, add the JSON 
window dressing, then encode the whole shebang again:

my $code = slurp($ARGV[0]);
$code =uri_escape_utf8($code,"^A-Za-z");
$code = "{\"code\": \"$code\" }";
$code =uri_escape_utf8($code,"^A-Za-z");

That did it for me.


Regards,
Daniel

b a schrieb:
> So I tried the following Perl code to do what you said, didn't work
> out very well :(
> I see that the slashes are  %252F and spaces are encoded as being
> %2520 instead of %20,
> I tried to use uri_escape_utf8 for that, or tried a regex, neither of
> which worked..
> 
> 
> use strict;
> use warnings;
> use URI::Escape;
> use Perl6::Slurp;
> 
> my $code = slurp($ARGV[0]);
> $code = "{\"code\": \"$code\" }";
> 
> $code =uri_escape_utf8($code,"^A-Za-z");
> 
> my $url = "http://demo.qooxdoo.org/current/playground/#$code";;
> 
> print $url;
> 
> my $command = "firefox \"$url\"";
> system($command);
> 
> 
> On 8/19/10, Daniel Wagner <daniel.wag...@1und1.de> wrote:
>> Don't know much about vi, but maybe you can get it to load a Playground
>> URI with the code attached in the browser. The format is this:
>>
>> { "code": "// your code here" }
>>
>> URIencode this and then load like so:
>>
>> http://demo.qooxdoo.org/devel/playground/index.html#%7B%22code%22%3A%20%22%252F%252Fyour%2520code%2520here%22%7D
>>
>> Note that different browsers have different length limits for URIs so if
>> your code gets too long it may not work.
>>
>>
>> Regards,
>> Daniel
>>
>> b a schrieb:
>>> Is there a way that I could edit my code with vim and then try it in
>>> the playground ? I want to automate this somehow from the console..
>>>
>>> ------------------------------------------------------------------------------
>>> This SF.net email is sponsored by
>>>
>>> Make an app they can't live without
>>> Enter the BlackBerry Developer Challenge
>>> http://p.sf.net/sfu/RIM-dev2dev
>>> _______________________________________________
>>> qooxdoo-devel mailing list
>>> qooxdoo-devel@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
>>>
>>>
>>
>> ------------------------------------------------------------------------------
>> This SF.net email is sponsored by
>>
>> Make an app they can't live without
>> Enter the BlackBerry Developer Challenge
>> http://p.sf.net/sfu/RIM-dev2dev
>> _______________________________________________
>> qooxdoo-devel mailing list
>> qooxdoo-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
>>
> 
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by 
> 
> Make an app they can't live without
> Enter the BlackBerry Developer Challenge
> http://p.sf.net/sfu/RIM-dev2dev 
> _______________________________________________
> qooxdoo-devel mailing list
> qooxdoo-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
> 
> 


------------------------------------------------------------------------------
This SF.net email is sponsored by 

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev 
_______________________________________________
qooxdoo-devel mailing list
qooxdoo-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to