Skip to main content
K.Daube
Community Expert
Community Expert
April 22, 2015
Answered

Not well-formed (invalid token)

  • April 22, 2015
  • 1 reply
  • 2166 views

Dear experts,

During developing my script - I can not use the ESTK on my system - with editing it in EditPad (UTF-8 file) and then executing it in FM-12 I got the message:

Script Error :
Error Message      : Not well-formed (invalid token)
Script, Line#   : E:\_DDDprojects\FM-biblio\test-scripts\t-read-formatted.jsx,  6

Fiddling around a lot, deleting initial comment lines, converting the file to Windows code page back and then again to UTF-8 the error persisted.

I then run the script in ETSK on the pc of my wife (which is very slow, but is a standard Windows 7 x32 installation) - no problem at all. I saved the script and went back to my system: problem was gone!

But now I have the same error with another script. The really strange thing is this: the reported line is always 6, even if I either delete (for the time beeing) irreleant lines or insert such at the beginning.

More strange things. My growing script in the project I have mentioned more than once now cretates the error when starting it.

Script Error :
Error Message      : Character conversion error
Script, Line#   : H:\Adobe\framemaker.12en\AdobeFrameMaker12\10,  0

This messages in itself is rubbish: the script loaded is E:\_DDDprojects\FM-biblio\escript\FM-biblio.jsx ...

Well at first I will restart Windows and then look at this again.

This topic has been closed for replies.
Correct answer K.Daube

Well, it turns out that a jsx file must not contain umlauts if it is coded in cp 1252 (Windows).

var menuRes1 =   {en: "Resolve temp. citations",
                  de: "Temp. zitate auflösen"};

You will get very strange error messages which You can not
-  Error Message      : Unterminated string constant
   Script, Line#   : E:\_DDDprojects\FM-biblio\test-scripts\t-menu-setup.jsx,  31 (line 01 in the example above).
- No definition found in script for function 'Command'
   Script : "E:\_DDDprojects\FM-biblio\test-scripts\t-menu-setup.jsx"

Although You do not have a real error in the script.

Hence such script files must be UTF-8

And sorry, in my first post in this thread the first error cited was a 'grievous fault of me' (to cite Shakespeare):

Not well-formed (invalid token)

was the result of not opening a jsx file, but a FrameMaker file ...

My wife is completely right when she says: often you are to fast with your reaction.

The finding for my second remark is this:
at least the character ¶ is not allowed in the script comments, although it is coded in UTF-8. How to know what else is not allowed - and how about string constants?

1 reply

K.Daube
Community Expert
K.DaubeCommunity ExpertAuthorCorrect answer
Community Expert
April 22, 2015

Well, it turns out that a jsx file must not contain umlauts if it is coded in cp 1252 (Windows).

var menuRes1 =   {en: "Resolve temp. citations",
                  de: "Temp. zitate auflösen"};

You will get very strange error messages which You can not
-  Error Message      : Unterminated string constant
   Script, Line#   : E:\_DDDprojects\FM-biblio\test-scripts\t-menu-setup.jsx,  31 (line 01 in the example above).
- No definition found in script for function 'Command'
   Script : "E:\_DDDprojects\FM-biblio\test-scripts\t-menu-setup.jsx"

Although You do not have a real error in the script.

Hence such script files must be UTF-8

And sorry, in my first post in this thread the first error cited was a 'grievous fault of me' (to cite Shakespeare):

Not well-formed (invalid token)

was the result of not opening a jsx file, but a FrameMaker file ...

My wife is completely right when she says: often you are to fast with your reaction.

The finding for my second remark is this:
at least the character ¶ is not allowed in the script comments, although it is coded in UTF-8. How to know what else is not allowed - and how about string constants?