AjaxMin with Combine not preserving encoding.

Jun 20, 2013 at 2:48 AM
I've tried everything and am about at the end of the road here. When I run AjaxMin in our TFS build on separate files with the -enc:in utf-8 -enc:out utf-8 -clobber switches like so:

<AjaxMin Switches="-enc:in utf-8 -enc:out utf-8" JsSourceFiles="@(RetailJS)" JsSourceExtensionPattern=".js$" JsTargetExtension=".js" />

Everything works fine, the encoding is preserved into the output files. When I run it to monify and combine multiple files like so:

<ItemGroup>
<AdJS Include="$(AdJS_AdControlFile); $(AdJS_SettingsControlFile)" />
</ItemGroup>
<AjaxMin Switches="-enc:in utf-8 -enc:out utf-8 -clobber" JsSourceFiles="@(AdJS)" JsCombinedFileName="$(AdJS_RelOutputFile)" />

The encoding is not preserved in the output file. The output files is encoded in ANSI instead of utf-8.

Is this a bug?
Coordinator
Jun 20, 2013 at 5:48 PM
Yes, this bug was fixed with release 4.81 back in January. Changeset #97795 indicates that the build task was totally ignoring the -enc:in and -enc:out switches. Please update to the latest version and see if your problem is resolved.
Coordinator
Jun 20, 2013 at 5:56 PM
Also, you're probably actually seeing a UTF-8 encoded file; it just doesn't have the BOM by default. Once you update to a newer version, though, explicitly specifying the output encoding to utf-8 as you are doing will cause the BOM to be in the output file as you expect.
Jun 20, 2013 at 6:40 PM
Thanks! Upgrading to the newest version did in fact fix the issue and now the encoding is preserved correctly.