[SOLVED] SyntaxError on three.js file Android

[SOLVED] See third post.

Okay, this might not be the right place to ask, since I have the same problem with jquery, but I didn’t have a better idea so here it goes.

I’ve searched all over the internet and can’t find anywhere where this problem is mentioned.

It took me a while to determine this but I’ve been having a problem for over an hour with some code, couldn’t figure it out. Then I checked the console (then spent close to an hour searching online). I get a SyntaxError: illegal character on the actual three.js file. (And the jquery file.) On my Windows computer, I don’t have this problem, and the problem occurs in both Firefox and Chrome on Android.

Where the line number for the error should be, there’s a bunch of non-Latin characters. Mostly Chinese looking.

Sounds like an encoding problem to me, but when it doesn’t happen on Windows, and no one else seems to have the issue…

(Note that I don’t have console viewing capabilities for Chrome on Android so I don’t know if it has any different information.)

Anyone have any similar issues? Any thoughts? I’m using an S7 Edge and a relatively new version of Android. (I’ll get the version number shortly, transferring files right now.)

EDIT: I am using the current version of both three js and jquery.

Little update, the problem does not occur if I reference the online copy of the file at threejs.org/build/three.js instead of downloading that file and referencing it locally.

1 Like

[SOLUTION]

I added the charset=“utf-8” to my script references. For whatever reason either Android or both Firefox and Chrome assume encoding that isn’t utf-8.

Well, problem solved. Keeping this here to hopefully prevent the difficulty I had from happening to someone else.

1 Like

Had you already included <meta charset="utf-8" /> or the equivalent <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> in your html head section?

I had yes, I did think that maybe specifying it for the main document would mess things up if the others weren’t encoded as such, but removing it didn’t fix the problem. Currently my solution has the main document with a meta tag indicating the encoding, and the script tags for threejs and jquery both also specify encoding.