2 * noVNC: HTML5 VNC client
3 * Copyright (C) 2019 The noVNC Authors
4 * Licensed under MPL 2.0 (see LICENSE.txt)
6 * See README.md for usage and integration instructions.
10export function decodeUTF8(utf8string, allowLatin1=false) {
12 return decodeURIComponent(escape(utf8string));
14 if (e instanceof URIError) {
16 // If we allow Latin1 we can ignore any decoding fails
17 // and in these cases return the original string
26export function encodeUTF8(DOMString) {
27 return unescape(encodeURIComponent(DOMString));