<?php
$output = @iconv_mime_encode('', $str,
array(
'scheme' => 'Q',
'line-length' => 76,
'input-charset' => 'UTF-8',
'output-charset' => 'UTF-8',
'line-break-chars' => "\n"
)
);
// There are reports that iconv_mime_encode() might fail and return FALSE
//if ($output !== FALSE)
//{
// iconv_mime_encode() will always put a header field name.
// We've passed it an empty one, but it still prepends our
// encoded string with ': ', so we need to strip it.
echo substr($output, 2);
//}
// $chars = iconv_strlen($str, 'UTF-8');