MCPcopy Create free account
hub / github.com/hydro-dev/Hydro / _utf8Decode

Function _utf8Decode

packages/ui-default/utils/base64.js:78–101  ·  view source on GitHub ↗
(utftext)

Source from the content-addressed store, hash-verified

76 },
77
78 _utf8Decode(utftext) {
79 let string = '';
80 let i = 0;
81 let c = 0;
82 let c2 = 0;
83 let c3 = 0;
84 while (i < utftext.length) {
85 c = utftext.charCodeAt(i);
86 if (c < 128) {
87 string += String.fromCharCode(c);
88 i++;
89 } else if ((c > 191) && (c < 224)) {
90 c2 = utftext.charCodeAt(i + 1);
91 string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
92 i += 2;
93 } else {
94 c2 = utftext.charCodeAt(i + 1);
95 c3 = utftext.charCodeAt(i + 2);
96 string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
97 i += 3;
98 }
99 }
100 return string;
101 },
102};
103
104export default Base64;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected