| Index: remoting/webapp/base.js
|
| diff --git a/remoting/webapp/base.js b/remoting/webapp/base.js
|
| index c2bf1a2b54b28a67c9f7422f10887a5dae5bd2e9..17cfc2971f612f3fdb8a5b0f56090bb6e19b20f6 100644
|
| --- a/remoting/webapp/base.js
|
| +++ b/remoting/webapp/base.js
|
| @@ -385,3 +385,28 @@ base.EventSource.prototype = {
|
| });
|
| }
|
| };
|
| +
|
| +/**
|
| + * Converts UTF-8 string to ArrayBuffer.
|
| + *
|
| + * @param {string} string
|
| + * @return {ArrayBuffer}
|
| + */
|
| +base.encodeUtf8 = function(string) {
|
| + var utf8String = unescape(encodeURIComponent(string));
|
| + var result = new Uint8Array(utf8String.length);
|
| + for (var i = 0; i < utf8String.length; i++)
|
| + result[i] = utf8String.charCodeAt(i);
|
| + return result.buffer;
|
| +}
|
| +
|
| +/**
|
| + * Decodes UTF-8 string from ArrayBuffer.
|
| + *
|
| + * @param {ArrayBuffer} buffer
|
| + * @return {string}
|
| + */
|
| +base.decodeUtf8 = function(buffer) {
|
| + return decodeURIComponent(
|
| + escape(String.fromCharCode.apply(null, new Uint8Array(buffer))));
|
| +}
|
|
|