From 1a3e04fc84a209d864f8c54dd7aa30274786ba3a Mon Sep 17 00:00:00 2001 From: Carsten Henkelmann Date: Thu, 19 Jan 2017 11:47:43 +0100 Subject: [PATCH] #85: fix for getting the correct content-length when using charset other than utf-8. --- src/VCard.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/VCard.php b/src/VCard.php index 440895a..c495d1e 100644 --- a/src/VCard.php +++ b/src/VCard.php @@ -526,7 +526,7 @@ protected function fold($text) // split, wrap and trim trailing separator return substr(chunk_split($text, 73, "\r\n "), 0, -3); } - + /** * Escape newline characters according to RFC2425 section 5.8.4. * @@ -538,7 +538,7 @@ protected function escape($text) { $text = str_replace("\r\n", "\\n", $text); $text = str_replace("\n", "\\n", $text); - + return $text; } @@ -622,7 +622,7 @@ public function getHeaders($asAssociative) { $contentType = $this->getContentType() . '; charset=' . $this->getCharset(); $contentDisposition = 'attachment; filename=' . $this->getFilename() . '.' . $this->getFileExtension(); - $contentLength = strlen($this->getOutput()); + $contentLength = mb_strlen($this->getOutput(), $this->getCharset()); $connection = 'close'; if ((bool) $asAssociative) {