function validateUtf8(bytes, start, end) {
	    var continuation = 0;
	    for (var i = start; i < end; i += 1) {
	        var byte = bytes[i];
	        if (continuation) {
	            if ((byte & FIRST_TWO_BITS) !== CONTINUING_CHAR) {
	                return false;
	            }
	            continuation -= 1;
	        }
	        else if (byte & FIRST_BIT) {
	            if ((byte & FIRST_THREE_BITS) === TWO_BIT_CHAR) {
	                continuation = 1;
	            }
	            else if ((byte & FIRST_FOUR_BITS) === THREE_BIT_CHAR) {
	                continuation = 2;
	            }
	            else if ((byte & FIRST_FIVE_BITS) === FOUR_BIT_CHAR) {
	                continuation = 3;
	            }
	            else {
	                return false;
	            }
	        }
	    }
	    return !continuation;
	}
/**
	 * Determines if the passed in bytes are valid utf8
	 * @param bytes - An array of 8-bit bytes. Must be indexable and have length property
	 * @param start - The index to start validating
	 * @param end - The index to end validating
	 */
Determines if the passed in bytes are valid utf8
@param bytes - An array of 8-bit bytes. Must be indexable and have length property
@param start - The index to start validating
@param end - The index to end validating
Determines if the passed in bytes are valid utf8 @param bytes - An array of 8 - bit bytes . Must be indexable and have length property @param start - The index to start validating @param end - The index to end validating
function validateUtf8(bytes, start, end) {
	    var continuation = 0;
	    for (var i = start; i < end; i += 1) {
	        var byte = bytes[i];
	        if (continuation) {
	            if ((byte & FIRST_TWO_BITS) !== CONTINUING_CHAR) {
	                return false;
	            }
	            continuation -= 1;
	        }
	        else if (byte & FIRST_BIT) {
	            if ((byte & FIRST_THREE_BITS) === TWO_BIT_CHAR) {
	                continuation = 1;
	            }
	            else if ((byte & FIRST_FOUR_BITS) === THREE_BIT_CHAR) {
	                continuation = 2;
	            }
	            else if ((byte & FIRST_FIVE_BITS) === FOUR_BIT_CHAR) {
	                continuation = 3;
	            }
	            else {
	                return false;
	            }
	        }
	    }
	    return !continuation;
	}
function validateUtf8 ( bytes , start , end ) { var continuation = 0 ; for ( var i = start ; i < end ; i += 1 ) { var byte = bytes [ i ] ; if ( continuation ) { if ( ( byte & FIRST_TWO_BITS ) !== CONTINUING_CHAR ) { return false ; } continuation -= 1 ; } else if ( byte & FIRST_BIT ) { if ( ( byte & FIRST_THREE_BITS ) === TWO_BIT_CHAR ) { continuation = 1 ; } else if ( ( byte & FIRST_FOUR_BITS ) === THREE_BIT_CHAR ) { continuation = 2 ; } else if ( ( byte & FIRST_FIVE_BITS ) === FOUR_BIT_CHAR ) { continuation = 3 ; } else { return false ; } } } return ! continuation ; }
Determines if the passed in bytes are valid utf8
 @param bytes - An array of 8-bit bytes.
Determines if the passed in bytes are valid utf8 @param bytes - An array of 8 - bit bytes .