Suppress conversion of escaped characters in a string

Feb 21, 2013 at 5:53 PM
The minifier is handling my UTF-8 files great now.

But is it possible to suppress the conversion of unicode escaped characters into their literal characters.

eg in my source I have "some string \u00B0" gets converted to "some string °"

Cheers
Mark
Coordinator
Feb 21, 2013 at 7:04 PM
Sure -- don't use the UTF-8 encoding for output. If you use, say, ASCII (-enc:out ascii), then extended characters like that will be output using the \uXXXX encoding pattern. If you are using the DLL, run your minified string through a stream using ASCII Encoding object and the JSEncodingFallback (see http://ajaxmin.codeplex.com/wikipage?title=EncoderFallbacks).

Or you can use a kill-switch to stop all optimizations on all string literals: if you are using the DLL, set your CodeSettings object's KillSwitch property to TreeModifications.MinifyStringLiterals. Or using the command line, -kill:0x100000.
Feb 21, 2013 at 8:02 PM
Thanks, I guess I should have said I'm using the standalone exe, I'll give this a try.
Coordinator
Mar 4, 2013 at 3:47 PM
I think using the -enc:out ascii switch will get you what you need.
Coordinator
Jun 3, 2013 at 3:26 PM
Or with the 4.93 release, use the switch -esc:true and it will always escape characters greater than \u007f, no matter what output encoding you choose.