/// Start Moodle Hack - do our own multibyte-safe header encoding
$textlib = textlib_get_instance();
- $result = $textlib->encode_mimeheader($str, $this->CharSet);
- if ($result !== false) {
- return $result;
+ $encoded = $textlib->encode_mimeheader($str, $this->CharSet);
+ if ($encoded !== false) {
+ $encoded = str_replace("\n", $this->LE, $encoded);
+ if ($position == 'phrase') {
+ return ("\"$encoded\"");
+ }
+ return $encoded;
}
// try the old way that does not handle binary-safe line splitting in mime header
/// End Moodle Hack