openbibleinfo / Bible-Passage-Reference-Parser

Coffeescript to identify and understand Bible references like "John 3:16."
223 stars 65 forks source link

Uncaught SyntaxError #11

Closed vincenzo closed 9 years ago

vincenzo commented 9 years ago

Hi.

When I include any JS file other than en_bcv_parser.min.js (even with the non-minified English file), I get this error in the JS console:

screen shot 2015-01-28 at 07 54 59

I am doing

<script src="js/it_bcv_parser.js"></script>
<script>
        var bcv = new bcv_parser;
        var b = bcv.parse("Numeri 23:19");
        alert(b.osis());
</script>

(and similar with other languages).

PS: thanks for opensourcing this, it's really useful.

openbibleinfo commented 9 years ago

It looks like the file isn't being interpreted as UTF-8. If you change your script tag to read:

<script src="js/it_bcv_parser.js" charset="UTF-8"></script>

Does that fix it?

I'm of two minds about including raw UTF-8 characters in the Javascript files--on one hand, it saves bandwidth, but on the other, it can lead to inconsistencies like this. Minifying the file, as you note, solves the problem by always using \uxxxx escaped characters.

vincenzo commented 9 years ago

@openbibleinfo Yeah, good call. That does fix it. So it's either that, or I'll just minify the JS file I need to use. I am guessing you are not thinking to include minified versions of all JS files? ;)

openbibleinfo commented 9 years ago

Since the minified files are derived directly from the js files, I wasn't planning on providing them for all the languages, no. Sorry. :)

vincenzo commented 9 years ago

No worries ;)