File .scripted fails to parse with BOM #54

Open
cawoodm opened this Issue Dec 11, 2012 · 5 comments

Comments

Projects
None yet
2 participants
@cawoodm

cawoodm commented Dec 11, 2012

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

This comment has been minimized.

Show comment
Hide comment
@aeisenberg

aeisenberg Dec 11, 2012

Contributor

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.

Contributor

aeisenberg commented Dec 11, 2012

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

This comment has been minimized.

Show comment
Hide comment
@cawoodm

cawoodm Dec 12, 2012

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"]
    }

}

cawoodm commented Dec 12, 2012

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

This comment has been minimized.

Show comment
Hide comment
@aeisenberg

aeisenberg Dec 12, 2012

Contributor

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.

Contributor

aeisenberg commented Dec 12, 2012

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

This comment has been minimized.

Show comment
Hide comment
@cawoodm

cawoodm Dec 12, 2012

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.

cawoodm commented Dec 12, 2012

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

This comment has been minimized.

Show comment
Hide comment
@aeisenberg

aeisenberg Dec 12, 2012

Contributor

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.

Contributor

aeisenberg commented Dec 12, 2012

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment