From 91275a655cefd61f21a09cf50412cad752a9368c Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Thu, 9 Mar 2006 19:24:59 +0100 Subject: fix for quoted printable encoding This patch replaces the old mail_quotedprintable_encode function with a better one which makes sure to never split an encoded character. This also makes sure mail headers aren't wrapped when quoting is needed. darcs-hash:20060309182459-7ad00-0c442b5422e9727fc70d206f8e1bcd6281536573.gz --- _test/cases/inc/mail_quoted_printable_encode.php | 44 ++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 _test/cases/inc/mail_quoted_printable_encode.php (limited to '_test') diff --git a/_test/cases/inc/mail_quoted_printable_encode.php b/_test/cases/inc/mail_quoted_printable_encode.php new file mode 100644 index 000000000..d74c0ea3f --- /dev/null +++ b/_test/cases/inc/mail_quoted_printable_encode.php @@ -0,0 +1,44 @@ +assertEqual(mail_quotedprintable_encode($in),$out); + } + + function test_spaceend(){ + $in = "hello \nhello"; + $out = "hello=20\r\nhello"; + $this->assertEqual(mail_quotedprintable_encode($in),$out); + } + + function test_german_utf8(){ + $in = 'hello überlänge'; + $out = 'hello =C3=BCberl=C3=A4nge'; + $this->assertEqual(mail_quotedprintable_encode($in),$out); + } + + function test_wrap(){ + $in = '123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789'; + $out = "123456789 123456789 123456789 123456789 123456789 123456789 123456789 1234=\r\n56789 123456789"; + $this->assertEqual(mail_quotedprintable_encode($in,74),$out); + } + + function test_nowrap(){ + $in = '123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789'; + $out = '123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789'; + $this->assertEqual(mail_quotedprintable_encode($in,0),$out); + } + + function test_russian_utf8(){ + $in = 'Ваш пароль для системы Доку Вики'; + $out = '=D0=92=D0=B0=D1=88 =D0=BF=D0=B0=D1=80=D0=BE=D0=BB=D1=8C =D0=B4=D0=BB=D1=8F =D1=81=D0=B8=D1=81=D1=82=D0=B5=D0=BC=D1=8B =D0=94=D0=BE=D0=BA=D1=83 =D0=92=D0=B8=D0=BA=D0=B8'; + $this->assertEqual(mail_quotedprintable_encode($in,0),$out); + } +} + +//Setup VIM: ex: et ts=4 enc=utf-8 : -- cgit v1.2.3