diff options
author | Andreas Gohr <andi@splitbrain.org> | 2006-03-09 19:24:59 +0100 |
---|---|---|
committer | Andreas Gohr <andi@splitbrain.org> | 2006-03-09 19:24:59 +0100 |
commit | 91275a655cefd61f21a09cf50412cad752a9368c (patch) | |
tree | c2cf419eeb8752e99b4ae28ef48b0f1978e5e92b /_test/cases | |
parent | 21a1520719b2d1591e73318e35957ec581a5ec0f (diff) | |
download | rpg-91275a655cefd61f21a09cf50412cad752a9368c.tar.gz rpg-91275a655cefd61f21a09cf50412cad752a9368c.tar.bz2 |
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
Diffstat (limited to '_test/cases')
-rw-r--r-- | _test/cases/inc/mail_quoted_printable_encode.php | 44 |
1 files changed, 44 insertions, 0 deletions
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 @@ +<?php + +require_once DOKU_INC.'inc/mail.php'; + +class mail_quotedprintable_encode extends UnitTestCase { + + function test_simple(){ + $in = 'hello'; + $out = 'hello'; + $this->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 : |