MCPcopy Index your code
hub / github.com/ampproject/amphtml / utf8EncodeSync

Function utf8EncodeSync

third_party/subscriptions-project/swg.js:3204–3209  ·  view source on GitHub ↗

* Turn a string into UTF-8 bytes. * @param {string} string * @return {!Uint8Array}

(string)

Source from the content-addressed store, hash-verified

3202 * @return {!Uint8Array}
3203 */
3204function 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

Callers 3

hashFunction · 0.85
fetch_Method · 0.85

Calls 1

stringToBytesFunction · 0.70

Tested by

no test coverage detected