SPB Git

spb/admin-ka

Public
892 B · 36 lines javascript
1"use strict";23Object.defineProperty(exports, "__esModule", {4  value: true5});6exports.decodeUTF8 = decodeUTF8;7exports.encodeUTF8 = encodeUTF8;8/*9 * noVNC: HTML5 VNC client10 * Copyright (C) 2019 The noVNC authors11 * Licensed under MPL 2.0 (see LICENSE.txt)12 *13 * See README.md for usage and integration instructions.14 */1516// Decode from UTF-817function decodeUTF8(utf8string) {18  var allowLatin1 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;19  try {20    return decodeURIComponent(escape(utf8string));21  } catch (e) {22    if (e instanceof URIError) {23      if (allowLatin1) {24        // If we allow Latin1 we can ignore any decoding fails25        // and in these cases return the original string26        return utf8string;27      }28    }29    throw e;30  }31}3233// Encode to UTF-834function encodeUTF8(DOMString) {35  return unescape(encodeURIComponent(DOMString));36}
Files · af81ba22ed344a656eec6ad8750033d9da3cf173
Menu

Theme