Lombiq/Combinator

Russian characters becomes "????" after compression

Closed this issue · 3 comments

Hello.
Few our javascript files may contain some Russian characters for the notification messages for example. In the compressed js files these messages becomes like this:
var a=$("<div><p>Hello world!</p><p>?????? ???!</p><p>?? ? ?? ???????????!</p></div>");$("#layout-main").append(a);

We solved this issue by setting encoding property of the compressor in the MinificationService class:

public string MinifyJavaScript(string javaScript)
{
    if (string.IsNullOrEmpty(javaScript)) return string.Empty;

    var compressor = new JavaScriptCompressor();

    compressor.Encoding = Encoding.UTF8;

    return compressor.Compress(javaScript);
}

I see, this does look like an easy to overcome issue. Before I apply the fix to Combinator, could you tell whether the files themselves are encoded in UTF-8?

Yes, when I create new js file via Visual Studio it appears UTF-8-BOM encoded.

Thanks, fixed.