qprintable.go
func DetectEncoding(data string) *Encoding {
	if strings.Count(data, "\r") == 0 {
		return UnixTextEncoding
	} else if strings.Count(data, "\n") == 0 {
		return MacTextEncoding
	} else if strings.Count(data, "\r") == strings.Count(data, "\n") && strings.Count(data, "\r\n") == strings.Count(data, "\n") {
		return WindowsTextEncoding
	}
	return BinaryEncoding
}
func DetectEncoding(data string) *Encoding {
	if strings.Count(data, "\r") == 0 {
		return UnixTextEncoding
	} else if strings.Count(data, "\n") == 0 {
		return MacTextEncoding
	} else if strings.Count(data, "\r") == strings.Count(data, "\n") && strings.Count(data, "\r\n") == strings.Count(data, "\n") {
		return WindowsTextEncoding
	}
	return BinaryEncoding
}
func DetectEncoding ( data string ) * Encoding { if strings . Count ( data , " \r " ) == 0 { return UnixTextEncoding } else if strings . Count ( data , " \n " ) == 0 { return MacTextEncoding } else if strings . Count ( data , " \r " ) == strings . Count ( data , " \n " ) && strings . Count ( data , " \r \n " ) == strings . Count ( data , " \n " ) { return WindowsTextEncoding } return BinaryEncoding }
// Try to detect encoding of string:
// strings with no \r will be Unix,
// strings with \r and no \n will be Mac,
// strings with count(\r\n) == count(\r) == count(\n) will be Windows,
// other strings will be binary
Try to detect encoding of string : strings with no \ r will be Unix strings with \ r and no \ n will be Mac strings with count ( \ r \ n ) == count ( \ r ) == count ( \ n ) will be Windows other strings will be binary