function Base64MimeHeaderEncoder::encodeString
Takes an unencoded string and produces a Base64 encoded string from it.
If the charset is iso-2022-jp, it uses mb_encode_mimeheader instead of default encodeString, otherwise pass to the parent method.
Overrides Base64Encoder::encodeString
File
-
vendor/
symfony/ mime/ Encoder/ Base64MimeHeaderEncoder.php, line 30
Class
- Base64MimeHeaderEncoder
- @author Chris Corbyn
Namespace
Symfony\Component\Mime\EncoderCode
public function encodeString(string $string, ?string $charset = 'utf-8', int $firstLineOffset = 0, int $maxLineLength = 0) : string {
if ('iso-2022-jp' === strtolower($charset)) {
$old = mb_internal_encoding();
mb_internal_encoding('utf-8');
$newstring = mb_encode_mimeheader($string, 'iso-2022-jp', $this->getName(), "\r\n");
mb_internal_encoding($old);
return $newstring;
}
return parent::encodeString($string, $charset, $firstLineOffset, $maxLineLength);
}