Skip to content

Commit

Permalink
Add more tests for UTF7-IMAP text conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
alexdowad committed Aug 31, 2021
1 parent 16a1e0a commit df32267
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions ext/mbstring/tests/utf7imap_encoding.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,17 @@ testValid("&" . mBase64(utf16BE("西红柿") . $longChar1) . "-", "西红柿" .
/* Multiple sections of valid ASCII _and_ Base64-encoded text */
testValid("123&" . mBase64(utf16BE("123")) . "-abc&" . mBase64(utf16BE("")) . "-.", "123123abc☺.");

/* If a & character appears right after a non-ASCII character, we must first close the Base64
* section and then emit &- */
testValidString("☺&", "&Jjo-&-", "UTF-8", "UTF7-IMAP", false);
testValidString("西瓜&", "&iX903A-&-", "UTF-8", "UTF7-IMAP", false);
testValidString("西红柿&", "&iX9+omf,-&-", "UTF-8", "UTF7-IMAP", false);

echo "Identification and conversion of valid text is working... perfect!\n";

// Try illegal Unicode codepoint (> 0x10FFFF)
convertInvalidString("\x00\x20\x00\x00", "%", "UCS-4BE", "UTF7-IMAP");

// Test "long" illegal character markers
mb_substitute_character("long");
convertInvalidString("\x10", "%", "UTF7-IMAP", "UTF-8");
Expand Down

0 comments on commit df32267

Please sign in to comment.