tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

escape-above-astral.js (854B)


      1 // Copyright (C) 2017 Microsoft Corporation. All rights reserved.
      2 // This code is governed by the BSD license found in the LICENSE file.
      3 /*---
      4 esid: sec-escape-string
      5 es6id: B.2.1.1
      6 description: Escaping of code units above 255 from string with extended Unicode escape sequence
      7 info: |
      8    [...]
      9    5. Repeat, while k < length,
     10       a. Let char be the code unit (represented as a 16-bit unsigned integer)
     11          at index k within string.
     12       [...]
     13       c. Else if char ≥ 256, then
     14          i. Let S be a String containing six code units "%uwxyz" where wxyz
     15             are the code units of the four uppercase hexadecimal digits
     16             encoding the value of char.
     17       [...]
     18 ---*/
     19 
     20 assert.sameValue(
     21  escape('\u{10401}'), '%uD801%uDC01', '\\u{10401} => \\uD801\\uDC01 (surrogate pairs encoded in string)'
     22 );
     23 
     24 reportCompare(0, 0);