SPB Git forge

spb/admin-ka

Public
41commits 1branches 0releases
172.9 MBsize
maindefault branch
19 days agolast push
JavaScript 65.5% Python 17.8% CSS 13% HTML 3.7%
745 B · 29 lines javascript
Raw Blame History
1/*2 * noVNC: HTML5 VNC client3 * Copyright (C) 2019 The noVNC authors4 * Licensed under MPL 2.0 (see LICENSE.txt)5 *6 * See README.md for usage and integration instructions.7 */89// Decode from UTF-810export 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 fails17                // and in these cases return the original string18                return utf8string;19            }20        }21        throw e;22    }23}2425// Encode to UTF-826export function encodeUTF8(DOMString) {27    return unescape(encodeURIComponent(DOMString));28}29