VSCodeMinify icon indicating copy to clipboard operation
VSCodeMinify copied to clipboard

Charset problems

Open Valkhan opened this issue 6 years ago • 0 comments

I've noticed that minifying a file is assuming the output as UTF-8.

The problem is that any files in other charsets (ISO-8859-1 in my case) will have problems like:

'Não' becomes 'Não'

Some possible solutions are:

  1. Auto-Detect input charset (I believe that's the most complicated solution as VSCode itself can't successfully detect charset sometimes)
  2. Look for "files.encoding" option in Folders/Workspace/User settings and consider that charset as output.
  3. Add an option to choose output file charset.

For options 2 and 3 if possible, properly convert charsets.

A very ugly workaround would be: (That's what I'm doing manually) I'm using the auto-minify if .min file exists. After saving and minifying the file:

  • Open the minified file.
  • Reopen the minified file with UTF-8.
  • Save the minified file with the desired charset

Additional notes:

VSCode option: files.encoding is very dumb, it forces all files to open as the selected encoding and doesn't give any warnings if the actual file is written in other charsets, I've tried using auto_detect charset option but it's even worse, it changes ISO-8859-1 to windows1252, and many other charsets are wrongfully detected causing an enormous hell.

I do hope you can help me out in this, thank you for your amazing work so far.

Valkhan avatar Jun 05 '18 19:06 Valkhan