vmware-archive / scripted

The Scripted code editor
Eclipse Public License 1.0
1.56k stars 166 forks source link

File .scripted fails to parse with BOM #54

Open cawoodm opened 11 years ago

cawoodm commented 11 years ago

If you save .scripted as a UTF-8 (with BOM) you get the following error in the console: Problems getting scripted configuration: Couldn't parse (JSON5) 'C:/Marc/Pers/Work/JavaScript/offline/bible/.scripted' ERROR: SyntaxError: Unexpected ''

aeisenberg commented 11 years ago

What are the contents of the file?

On Tue, Dec 11, 2012 at 12:38 PM, cawoodm notifications@github.com wrote:

If you save .scripted as a UTF-8 (with BOM) you get the following error in the console: Problems getting scripted configuration: Couldn't parse (JSON5) 'C:/Marc/Pers/Work/JavaScript/offline/bible/.scripted' ERROR: SyntaxError: Unexpected ''

— Reply to this email directly or view it on GitHubhttps://github.com/scripted-editor/scripted/issues/54.

cawoodm commented 11 years ago

I stripped the file down to {} and it still failed until I removed the BOM. However this was the original file:

{

    "ui": { 
        "font": "Courier New"
    },

    "editor": {
        "expandtab": true,
        "tabsize": 2
    },

    "jshint" : {
        "global" : ["console", "define", "exports", "module", "process", "__dirname", "require", "$", "window"]
    }

}
aeisenberg commented 11 years ago

I guess I am confused now...what do you mean by BOM?

On Wed, Dec 12, 2012 at 12:04 AM, cawoodm notifications@github.com wrote:

I stripped the file down to {} and it still failed until I removed the BOM. However this was the original file:

{

"ui": {
    "font": "Courier New"
},

"editor": {
    "expandtab": true,
    "tabsize": 2
},

"jshint" : {
    "global" : ["console", "define", "exports", "module", "process", "__dirname", "require", "$", "window"]
}

}

— Reply to this email directly or view it on GitHubhttps://github.com/scripted-editor/scripted/issues/54#issuecomment-11280029.

cawoodm commented 11 years ago

http://en.wikipedia.org/wiki/Byte_order_mark It's basically a FEFF byte sequence at the start of a unicode text file which tells the interpreter in which order the bytes of multi-byte characters appear in a byte stream. Unicode is real important to those working in multi-lingual environments. True, your configuration file probably doesn't need to be unicode but many people have switched to unicode on principle and all new files we make are UTF-8.

aeisenberg commented 11 years ago

Interesting....we are loading the file as UTF-8, so I don't know why this is failing. It might be that the JSON5 library that we are using doesn't recognize it.

Can you attach a failing file or send it to me directly if you can't attach files here?

I can try to isolate the problem through invoking the library directly.

On Wed, Dec 12, 2012 at 11:12 AM, cawoodm notifications@github.com wrote:

http://en.wikipedia.org/wiki/Byte_order_mark It's basically a FEFF byte sequence at the start of a unicode text file which tells the interpreter in which order the bytes of multi-byte characters appear in a byte stream. Unicode is real important to those working in multi-lingual environments. True, your configuration file probably doesn't need to be unicode but many people have switched to unicode on principle and all new files we make are UTF-8.

— Reply to this email directly or view it on GitHubhttps://github.com/scripted-editor/scripted/issues/54#issuecomment-11304164.