threedaymonk / htmlbeautifier

A normaliser/beautifier for HTML that also understands embedded Ruby. Ideal for tidying up Rails templates.
MIT License
325 stars 59 forks source link

Is there a way to specify file encoding? #40

Closed izaera closed 7 years ago

izaera commented 7 years ago

Hi there:

I'm using htmlbeautifier and it works great (good job 👍 ), but I would like to know if there's a way to specify file encoding for .erb files because htmlbeautifier complains about:

invalid byte sequence in US-ASCII on line 1

This is because I use unicode glyphs as icons and the beautifier fails to understand them.

Thanks in advance, Ivan Zaera

threedaymonk commented 7 years ago

It should (and, as far as I 'm aware, does) support UTF-8. Can you give me some more information?

Thanks!

izaera commented 7 years ago

Oops, that may be the problem: I'm running htmlbeautifier from Atom on Mac and it seems that I have a pretty bare environment with no LC_ or LANG variables at all.

Let me investigate it more and I'll come back with more data. I'll try to reproduce it from the command line.

BTW, thanks for the fast reply :-).

izaera commented 7 years ago

It seems to work from command line, so I guess it is a problem in the Atom plugin side. I'll further investigate it until I can fix it. I'll tell you after about my findings so that you can close this bug and in case it may be useful to someone having the same problem (or close it now if you want and I'll add the comment later, whatever you prefer :-) ).

Thanks for the help, again.

izaera commented 7 years ago

OK, I close it.

After much investigation, I have reinstalled the gem and the problem disappeared :-(. I did this before (some time ago) and it kept failing but this time it has worked.

Sorry and thanks for the hint.