* Turn a string into UTF-8 bytes. * @param {string} string * @return {!Uint8Array}
(string)
| 3202 | * @return {!Uint8Array} |
| 3203 | */ |
| 3204 | function utf8EncodeSync(string) { |
| 3205 | if (typeof TextEncoder !== 'undefined') { |
| 3206 | return new TextEncoder('utf-8').encode(string); |
| 3207 | } |
| 3208 | return stringToBytes(unescape(encodeURIComponent(string))); |
| 3209 | } |
| 3210 | |
| 3211 | /** |
| 3212 | * Converts a string which is in base64url encoding into a Uint8Array |
no test coverage detected