* Interpret a byte array as a UTF-8 string. * @param {!Uint8Array} bytes * @return {string}
(bytes)
| 3189 | * @return {string} |
| 3190 | */ |
| 3191 | function utf8DecodeSync(bytes) { |
| 3192 | if (typeof TextDecoder !== 'undefined') { |
| 3193 | return new TextDecoder('utf-8').decode(bytes); |
| 3194 | } |
| 3195 | const asciiString = bytesToString(new Uint8Array(bytes)); |
| 3196 | return decodeURIComponent(escape(asciiString)); |
| 3197 | } |
| 3198 | |
| 3199 | /** |
| 3200 | * Turn a string into UTF-8 bytes. |
no test coverage detected