func selectTransferEncoding(content []byte, quoteLineBreaks bool) transferEncoding {
	if len(content) == 0 {
		return te7Bit
	}
	// Binary chars remaining before we choose b64 encoding.
	threshold := b64Percent * len(content) / 100
	bincount := 0
	for _, b := range content {
		if (b < ' ' || '~' < b) && b != '\t' {
			if !quoteLineBreaks && (b == '\r' || b == '\n') {
				continue
			}
			bincount++
			if bincount >= threshold {
				return teBase64
			}
		}
	}
	if bincount == 0 {
		return te7Bit
	}
	return teQuoted
}
func selectTransferEncoding(content []byte, quoteLineBreaks bool) transferEncoding {
	if len(content) == 0 {
		return te7Bit
	}
	
	threshold := b64Percent * len(content) / 100
	bincount := 0
	for _, b := range content {
		if (b < ' ' || '~' < b) && b != '\t' {
			if !quoteLineBreaks && (b == '\r' || b == '\n') {
				continue
			}
			bincount++
			if bincount >= threshold {
				return teBase64
			}
		}
	}
	if bincount == 0 {
		return te7Bit
	}
	return teQuoted
}
func selectTransferEncoding ( content [ ] byte , quoteLineBreaks bool ) transferEncoding { if len ( content ) == 0 { return te7Bit } // Binary chars remaining before we choose b64 encoding. threshold := b64Percent * len ( content ) / 100 bincount := 0 for _ , b := range content { if ( b < ' ' || '~' < b ) && b != '\t' { if ! quoteLineBreaks && ( b == '\r' || b == '\n' ) { continue } bincount ++ if bincount >= threshold { return teBase64 } } } if bincount == 0 { return te7Bit } return teQuoted }
// selectTransferEncoding scans content for non-ASCII characters and selects 'b' or 'q' encoding.
selectTransferEncoding scans content for non - ASCII characters and selects b or q encoding .