ui/files.js
// Returns true if the data in the ArrayBuffer is UTF-8 text.
Returns true if the data in the ArrayBuffer is UTF-8 text.
Returns true if the data in the ArrayBuffer is UTF - 8 text .
function isUtf8 (buffer) {
		var view = new Uint8Array(buffer),
			check = Math.min(256, buffer.byteLength);
		for (var i = 0; i < check; i++) {
			var b = view[i];
			if (b <= 0x08 || b == 0x0B || (b >= 0x0E && b <= 0x1A) || (b >= 0x1C && b <= 0x1F))
				return false;
		}
		return true;
	}
function isUtf8 ( buffer ) { var view = new Uint8Array ( buffer ) , check = Math . min ( 256 , buffer . byteLength ) ; for ( var i = 0 ; i < check ; i ++ ) { var b = view [ i ] ; if ( b <= 0x08 || b == 0x0B || ( b >= 0x0E && b <= 0x1A ) || ( b >= 0x1C && b <= 0x1F ) ) return false ; } return true ; }
Returns true if the data in the ArrayBuffer is UTF-8 text.
Returns true if the data in the ArrayBuffer is UTF - 8 text .
// Adapted from https://mimesniff.spec.whatwg.org/ "binary data byte"