Commit 14503054 authored by Dave Methvin's avatar Dave Methvin

Use the correct escape for BOM; add build code to detect non-ASCII.

parent 798a7a7e
...@@ -416,6 +416,27 @@ module.exports = function( grunt ) { ...@@ -416,6 +416,27 @@ module.exports = function( grunt ) {
return path !== "*"; return path !== "*";
}); });
// Ensure the dist files are pure ASCII
var fs = require("fs"),
nonascii = false;
distpaths.forEach(function( filename ) {
var buf = fs.readFileSync( filename, "utf8" ),
i, c;
if ( buf.length !== Buffer.byteLength( buf, "utf8" ) ) {
log.writeln( filename + ": Non-ASCII characters detected:" );
for ( i = 0; i < buf.length; i++ ) {
c = buf.charCodeAt( i );
if ( c > 127 ) {
log.writeln( "- position " + i + ": " + c );
log.writeln( "-- " + buf.substring( i - 20, i + 20 ) );
nonascii = true;
}
}
}
});
if ( nonascii ) {
return false;
}
// Proceed only if there are actual // Proceed only if there are actual
// paths to write to // paths to write to
......
...@@ -605,7 +605,7 @@ jQuery.extend({ ...@@ -605,7 +605,7 @@ jQuery.extend({
}, },
// Use native String.trim function wherever possible // Use native String.trim function wherever possible
trim: core_trim && !core_trim.call("\xFEFF\xA0") ? trim: core_trim && !core_trim.call("\uFEFF\xA0") ?
function( text ) { function( text ) {
return text == null ? return text == null ?
"" : "" :
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment