From 50eac8739fe8e06fe0c91202a5b2b57279960834 Mon Sep 17 00:00:00 2001 From: Synchro Date: Wed, 25 Mar 2015 19:22:55 +0100 Subject: [PATCH] Use multibyte text in tests Add explicit test for UTF-8 with embedded images, see #279 and #377 Add ISO-8859-1 test --- class.smtp.php | 2 +- examples/contents.html | 16 ++++----- examples/contentsutf8.html | 20 +++++++++++ test/phpmailerTest.php | 68 +++++++++++++++++++++++++++++++++++--- 4 files changed, 93 insertions(+), 13 deletions(-) create mode 100644 examples/contentsutf8.html diff --git a/class.smtp.php b/class.smtp.php index 8c609d72..81a85d08 100644 --- a/class.smtp.php +++ b/class.smtp.php @@ -631,7 +631,7 @@ class SMTP if ($in_headers and $line == '') { $in_headers = false; } - //We need to break this line up into several smaller lines + //Break this line up into several smaller lines if it's too long //Micro-optimisation: isset($str[$len]) is faster than (strlen($str) > $len), while (isset($line[self::MAX_LINE_LENGTH])) { //Working backwards, try to find a space within the last MAX_LINE_LENGTH chars of the line to break on diff --git a/examples/contents.html b/examples/contents.html index 9257f6dd..dc3fc667 100644 --- a/examples/contents.html +++ b/examples/contents.html @@ -1,17 +1,17 @@ - + PHPMailer Test -
-

This is a test of PHPMailer.

-
- PHPMailer rocks -
-

This example uses HTML.

-

The PHPMailer image at the top has been embedded automatically.

+
+

This is a test of PHPMailer.

+
+ PHPMailer rocks
+

This example uses HTML.

+

ISO-8859-1 text:

+
diff --git a/examples/contentsutf8.html b/examples/contentsutf8.html new file mode 100644 index 00000000..81a20240 --- /dev/null +++ b/examples/contentsutf8.html @@ -0,0 +1,20 @@ + + + + + PHPMailer Test + + +
+

This is a test of PHPMailer.

+
+ PHPMailer rocks +
+

This example uses HTML.

+

Chinese text: 郵件內容為空

+

Russian text: Пустое тело сообщения

+

Armenian text: Հաղորդագրությունը դատարկ է

+

Czech text: Prázdné tělo zprávy

+
+ + diff --git a/test/phpmailerTest.php b/test/phpmailerTest.php index c08be0e6..2f871fa5 100644 --- a/test/phpmailerTest.php +++ b/test/phpmailerTest.php @@ -149,7 +149,7 @@ class PHPMailerTest extends PHPUnit_Framework_TestCase $eol = "
\r\n"; $bullet_start = '
  • '; $bullet_end = "
  • \r\n"; - $list_start = '