Bug 1617370 - Follow-up: Correct comment. rs=comment-only DONTBUILD
authorJorg Knobloch
Fri, 10 Apr 2020 10:19:26 +0200
changeset 38769 5a60280601f4f761896dc12d87c7e35c921c8fd2
parent 38768 d50b4d5fd63d4ca405d196f3ff6839793e22a597
child 38770 9361c493ce66bcc4bacac20f893e6c8beca893a9
push id401
push userclokep@gmail.com
push dateMon, 01 Jun 2020 20:41:59 +0000
reviewerscomment-only
bugs1617370
Bug 1617370 - Follow-up: Correct comment. rs=comment-only DONTBUILD
mailnews/mime/jsmime/test/unit/test_header.js
--- a/mailnews/mime/jsmime/test/unit/test_header.js
+++ b/mailnews/mime/jsmime/test/unit/test_header.js
@@ -853,18 +853,20 @@ define(function(require) {
               email: "foeA@example.com",
             },
           ],
         ],
 
         // Collapse multiple consecutive "special" spaces, like zero width space
         // etc. also when encoded.
         // \u00AD is soft hypen. \u200B is zero width space.
-        // btoa takes a binary string to encode. unescape(encodeURIComponent(source))
-        // does UTF-8 to binary conversion. See bug 1551746 for other ways.
+        // unescape(encodeURIComponent(source)) encodes the JavaScript UTF-16 representation
+        // of the string into UTF-8. Example: encodeURIComponent("ö") returns %C3%B6,
+        // unescape("%C3%B6") returns the bytes 0xC3B6 which is the UTF-8 encoding of "ö".
+        // See bug 1551746 for other ways.
         [
           //"=?UTF-8?B?IMKgIGJsw7YgPGludmlzaWJsZXNwYWNlQGZyaWVuZC5leGFtcGxlLmNvbT4g4oCLIOKAiyDigIsu=?= <foe@example.com>"
           `=?UTF-8?B?${btoa(
             unescape(
               encodeURIComponent(
                 " \u00AD blö <invisiblespace@friend.example.com> \u200B \u200B \u200B."
               )
             )