53 if ($this->charset !==
'utf-8') {
54 throw new RuntimeException(
55 sprintf(
'Charset "%s" not supported. NativeQpContentEncoder only supports "utf-8"', $this->charset));
60 while (
false !== $bytes = $os->
read(8192)) {
74 return 'quoted-printable';
88 public function encodeString($string, $firstLineOffset = 0, $maxLineLength = 0)
90 if ($this->charset !==
'utf-8') {
91 throw new RuntimeException(
92 sprintf(
'Charset "%s" not supported. NativeQpContentEncoder only supports "utf-8"', $this->charset));
95 return $this->
_standardize(quoted_printable_encode($string));
108 $string = preg_replace(
'~=0D(?!=0A)|(?<!=0D)=0A~',
'=0D=0A', $string);
110 $string = str_replace(array(
"\t=0D=0A",
' =0D=0A',
'=0D=0A'), array(
"=09\r\n",
"=20\r\n",
"\r\n"), $string);
112 switch ($end = ord(substr($string, -1))) {
114 $string = substr_replace($string,
'=09', -1);
117 $string = substr_replace($string,
'=20', -1);