MCPcopy Create free account
hub / github.com/apache/cloudstack / decodeUTF8

Function decodeUTF8

systemvm/agent/noVNC/core/util/strings.js:10–23  ·  view source on GitHub ↗
(utf8string, allowLatin1=false)

Source from the content-addressed store, hash-verified

8
9// Decode from UTF-8
10export function decodeUTF8(utf8string, allowLatin1=false) {
11 try {
12 return decodeURIComponent(escape(utf8string));
13 } catch (e) {
14 if (e instanceof URIError) {
15 if (allowLatin1) {
16 // If we allow Latin1 we can ignore any decoding fails
17 // and in these cases return the original string
18 return utf8string;
19 }
20 }
21 throw e;
22 }
23}
24
25// Encode to UTF-8
26export function encodeUTF8(DOMString) {

Callers 3

_negotiateServerInitMethod · 0.90
_handleServerCutTextMethod · 0.90
_handleDesktopNameMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected