charset of compiled js files

6 views
Skip to first unread message

Sebastian Gurin

unread,
Jul 4, 2008, 10:39:13 AM7/4/08
to Java2Script
Hi all.

I'm having the following situation. I want to use yuicompressor tool (http://www.julienlecomte.net/yuicompressor/) for code compression and packing of generated js files of a j2s project. I'm having troubles reading .js j2s generated files. yuicompressor (that uses rhino for js parsing) complains with the following errors for ALL .js j2s generated files.

[ERROR] 1:2:illegal character
[ERROR] 1:2:syntax error
[ERROR] 1:3:illegal character
[ERROR] 57:16:syntax error
[ERROR] 1:0:Compilation produced 4 syntax errors.

If I read a .js j2s generated file using a java BufferedReader, or a FileInputStream or a StringBuilder, i'm noting that strange characters appear in the beggining of the string. Something like

"Clazz.declarePackage"

i'm not an expert on charsets stuff so i'm very confused. ¿Can somebody tell me what is the charset of generated j2s .js files? or how can I correctly read from a filesystem into a string? The strange thing is that if i open .js files with notepad this strange characters are not showed, but parsers like rhino and yuicompressor complain...

thanks in advance.

--
Sebastian Gurin <sgu...@softpoint.org>

Zhou Renjian

unread,
Jul 4, 2008, 11:04:53 AM7/4/08
to java2...@googlegroups.com
Just ignore the first three bytes: EF BB BF, which indicate that it is an UTF-8 file.


Regards,
Zhou Renjian

Sebastian Gurin

unread,
Jul 4, 2008, 11:40:45 AM7/4/08
to java2...@googlegroups.com
On Fri, 4 Jul 2008 23:04:53 +0800
"Zhou Renjian" <zhour...@gmail.com> wrote:

> Just ignore the first three bytes: EF BB BF, which indicate that it is an
> UTF-8 file.
>

thanks zhou! and excuse me for my ignorance and for the OT....


--
Sebastian Gurin <sgu...@softpoint.org>

Reply all
Reply to author
Forward
0 new messages