Fixed a bug where the you could get encode/decode exceptions if JavaScript had non-ascii characters.

It will now use the source_encoding variable from the current conf.py.