Error(2): Invalid character

This forum can be browsed by the general public. Posting is limited to current SAPIEN license holders with active maintenance and does not offer a response time guarantee.
Forum rules
DO NOT POST LICENSE NUMBERS, ACTIVATION KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM.
Only the original author and our tech personnel can reply to a topic that is created in this forum. If you find a topic that relates to an issue you are having, please create a new topic and reference the other in your post.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
User avatar
clum09
Posts: 150
Joined: Thu Apr 24, 2008 9:11 am

Error(2): Invalid character

Post by clum09 » Wed Jan 04, 2012 7:45 am

Hello,

I tried to package a vbscript with PrimalScript 2009, and when I ran the packaged script, the scrpt ran for a while and then generated an error as "Error(2): Invalid character" without indicating what line of code the error was generated from.

However, if I just ran the original script that was not packaged by PrimalScript, the script ran just fine without any error.

I installed PrimalScript on Windows XP Professional with SP3, and I package my script within this OS.


What can be done to correct this issue?

Thanks you.

User avatar
Alexander Riedel
Posts: 7163
Joined: Tue May 29, 2007 4:43 pm

Error(2): Invalid character

Post by Alexander Riedel » Wed Jan 04, 2012 8:01 am

That's pretty hard to diagnose without anything else.
Do you use any international characters in your script?
Is your original script file unicode or ANSI?
Can you somehow narrow down the part where it does that and show us that portion of the code?
Alexander Riedel
SAPIEN Technologies, Inc.

User avatar
clum09
Posts: 150
Joined: Thu Apr 24, 2008 9:11 am

Error(2): Invalid character

Post by clum09 » Wed Jan 04, 2012 8:09 am

Alexander,

I did not use any strange characters within the script. Nor did I use any international characters.

Since the packaged script does not show any line number when it generated this error, I cannot pin point where location of the code that generated this error.

The fact that when I ran the script without packaging it and it did not generate any error this is very difficult to troubleshoot.

User avatar
Alexander Riedel
Posts: 7163
Joined: Tue May 29, 2007 4:43 pm

Error(2): Invalid character

Post by Alexander Riedel » Wed Jan 04, 2012 8:17 am

Well, you said the script "ran for a while" and then displayed that error.
I don't know what your script does, how long it is and so forth.
I also don't know if that is a long script that runs for a while or if that means the package worked for quite a while and started doing that now.

Can you add some statements like
WScript.Echo "Now at line XXX"
to the script, package it and see where it fails?
I know that is cumbersome, but probably the only way to narrow this down.

This could be output from a database query, attempting to open a file with an invalid character in the file name, reading a directory with invalid characters in names, a quote character that is not correct (like when editing with Word), a corrupted package (in case you haven't re-packaged)
etc. Many many options. So anything you can add would help.
Alexander Riedel
SAPIEN Technologies, Inc.

User avatar
clum09
Posts: 150
Joined: Thu Apr 24, 2008 9:11 am

Error(2): Invalid character

Post by clum09 » Wed Jan 04, 2012 8:38 am

Regardless of where the issue is, the packaged script should indicate the line where the error was generated from.

User avatar
Alexander Riedel
Posts: 7163
Joined: Tue May 29, 2007 4:43 pm

Error(2): Invalid character

Post by Alexander Riedel » Wed Jan 04, 2012 8:57 am

The error message is not generated by the package, it is a message from the VBScript engine. We have no control over that output.
Alexander Riedel
SAPIEN Technologies, Inc.

User avatar
clum09
Posts: 150
Joined: Thu Apr 24, 2008 9:11 am

Error(2): Invalid character

Post by clum09 » Thu Jan 05, 2012 12:47 am

But when I ran the script outside of the PrimalScript package (using cscript), I don't see this error.

User avatar
Alexander Riedel
Posts: 7163
Joined: Tue May 29, 2007 4:43 pm

Error(2): Invalid character

Post by Alexander Riedel » Thu Jan 05, 2012 5:06 am

I understand that. But it's not like we put this message in to make you come and post here :-)
When a script is packaged is is converted to unicode. Which is why I originally asked about the encoding of your script. But since you didn't answer that question I can't go any further with that.
I also don't know without any context if the text of script itself causes this error message or something you call from within your script. So again, I really need more information.
Alexander Riedel
SAPIEN Technologies, Inc.

User avatar
clum09
Posts: 150
Joined: Thu Apr 24, 2008 9:11 am

Error(2): Invalid character

Post by clum09 » Thu Jan 05, 2012 5:54 am

I did not encode the vbscript. I simply packaged the script right out of PrimalScript editor.

The script is very straightforward - no other script to call within the script except the functions and subroutines within the script.

User avatar
Alexander Riedel
Posts: 7163
Joined: Tue May 29, 2007 4:43 pm

Error(2): Invalid character

Post by Alexander Riedel » Thu Jan 05, 2012 6:23 am

We are not getting anywhere here. I was referring to the character encoding of your file.
http://en.wikipedia.org/wiki/Character_encoding
Can you just zip and email the script to support@sapien.com?
Alexander Riedel
SAPIEN Technologies, Inc.