public static function encodeString($string, $encoding, $eol = "\n") {
		$encoding = strtolower($encoding);
		switch($encoding) {
			case self::ENCODING_BASE64:
				return chunk_split(base64_encode($string), 76, $eol);
			case self::ENCODING_7BIT:
			case self::ENCODING_8BIT:
				$encoded = self::cleanEol($string, $eol);
				if (substr($encoded, - (strlen($eol))) != $eol) $encoded .= $eol;
				return $encoded;
			case self::ENCODING_BINARY:
				return $string;
			case self::ENCODING_QUOTED_PRINTABLE:
				return quoted_printable_encode($string);
			default:
				throw new MailException('invalid encoding type');
		}
	}
public static function encodeString($string, $encoding, $eol = "\n") {
		$encoding = strtolower($encoding);
		switch($encoding) {
			case self::ENCODING_BASE64:
				return chunk_split(base64_encode($string), 76, $eol);
			case self::ENCODING_7BIT:
			case self::ENCODING_8BIT:
				$encoded = self::cleanEol($string, $eol);
				if (substr($encoded, - (strlen($eol))) != $eol) $encoded .= $eol;
				return $encoded;
			case self::ENCODING_BINARY:
				return $string;
			case self::ENCODING_QUOTED_PRINTABLE:
				return quoted_printable_encode($string);
			default:
				throw new MailException('invalid encoding type');
		}
	}
public static function encodeString ( $ string , $ encoding , $ eol = "\n" ) { $ encoding = strtolower ( $ encoding ) ; switch ( $ encoding ) { case self :: ENCODING_BASE64 : return chunk_split ( base64_encode ( $ string ) , 76 , $ eol ) ; case self :: ENCODING_7BIT : case self :: ENCODING_8BIT : $ encoded = self :: cleanEol ( $ string , $ eol ) ; if ( substr ( $ encoded , - ( strlen ( $ eol ) ) ) != $ eol ) $ encoded .= $ eol ; return $ encoded ; case self :: ENCODING_BINARY : return $ string ; case self :: ENCODING_QUOTED_PRINTABLE : return quoted_printable_encode ( $ string ) ; default : throw new MailException ( 'invalid encoding type' ) ; } }
encodes a string to the given encoding
@param string $string
@param string $encoding
@param string $eol
@throws MailException
encodes a string to the given encoding