Escape

Post Reply
lohbrand
Newbie
Posts: 14
Joined: Thu Feb 02, 2012 8:41 pm

Escape

Post by lohbrand »

Hello,



we have tis Script:



var _testString = "Test&Test Test+Test=Test-Test";

_testString = escape(_testString);



and this one:



var _testString = "Test&Test Test+Test=Test-Test";

_testString = _testString.replace("+", "%2B");



the log say something like this:



Test/var/folders/ff/ffKQdrvpHF4CpidNJmasOU+++TY/-Tmp-/FixtureTest14/inFolder26Test/var/folders/ff/ffKQdrvpHF4CpidNJmasOU+++TY/-Tmp-/FixtureTest14/inFolder20Test+TestDTest-Test



Who need the Folder? Has anybody a tip?



Thanks Lohbrandt
lohbrand
Newbie
Posts: 14
Joined: Thu Feb 02, 2012 8:41 pm

Escape

Post by lohbrand »

Is there anybody from Enfocus, who can answer questions?
dkelly
TOP CONTRIBUTOR
Posts: 658
Joined: Mon Nov 29, 2010 8:45 pm
Location: Alpharetta GA USA
Contact:

Escape

Post by dkelly »

I'm a little confused. Your JS snippet doesn't involve a path at all. Did you append _testString variable to another value like job.getPath()? Did you mean to add a directory separator character, eg. '/', between inFolder and _testString?
lohbrand
Newbie
Posts: 14
Joined: Thu Feb 02, 2012 8:41 pm

Escape

Post by lohbrand »

thank for your post dkelly.

the script is what i post.

there is nothing else.



i dont understand the path in the log message, because there is no job.getPath() command.
rzacherl
Member
Posts: 38
Joined: Mon Mar 21, 2011 3:29 pm

Escape

Post by rzacherl »

Hello lohbrand,



based on the path I would state that you're using the Fixture (debugging) capabilities of SwitchScripter to test your script outside Switch.



Regards,



Robert
lohbrand
Newbie
Posts: 14
Joined: Thu Feb 02, 2012 8:41 pm

Escape

Post by lohbrand »

Hello,



the same answer in the log (PowerSwitch11).
dkelly
TOP CONTRIBUTOR
Posts: 658
Joined: Mon Nov 29, 2010 8:45 pm
Location: Alpharetta GA USA
Contact:

Escape

Post by dkelly »

Is this script being used in a script expression or a scripted element?
lohbrand
Newbie
Posts: 14
Joined: Thu Feb 02, 2012 8:41 pm

Escape

Post by lohbrand »

in a script-element
dkelly
TOP CONTRIBUTOR
Posts: 658
Joined: Mon Nov 29, 2010 8:45 pm
Location: Alpharetta GA USA
Contact:

Escape

Post by dkelly »

I guess I don't understand your question because a scripted element would need more code that that. A jobArrived() or timerFired() function at least.
lohbrand
Newbie
Posts: 14
Joined: Thu Feb 02, 2012 8:41 pm

Escape

Post by lohbrand »

function jobArrived( s : Switch, job : Job )

{

var _testString = "Test&Test Test+Test=Test-Test";

_testString = escape(_testString);



job.log(1,_testString);

}



what happend whit your engine?
lohbrand
Newbie
Posts: 14
Joined: Thu Feb 02, 2012 8:41 pm

Escape

Post by lohbrand »

Oke, we have a answer.

The commands log and fail will never display the char %.



Thanks.
marbledaemon
Newbie
Posts: 7
Joined: Mon Sep 24, 2012 12:28 pm

Escape

Post by marbledaemon »

It's true.



The 's.log' and other text-related functions will treat %[number] as a wildcard parameter. As you can see here, your %2B falls in that category as %2 is treated as the job folder.



You might want to write that text to a binary file to read it.
Post Reply