aboutsummaryrefslogtreecommitdiff
path: root/ext/js/pages/settings
diff options
context:
space:
mode:
Diffstat (limited to 'ext/js/pages/settings')
-rw-r--r--ext/js/pages/settings/backup-controller.js12
1 files changed, 2 insertions, 10 deletions
diff --git a/ext/js/pages/settings/backup-controller.js b/ext/js/pages/settings/backup-controller.js
index 02ad368c..cf1a6b0c 100644
--- a/ext/js/pages/settings/backup-controller.js
+++ b/ext/js/pages/settings/backup-controller.js
@@ -18,6 +18,7 @@
/* global
* DictionaryController
* OptionsUtil
+ * StringUtil
*/
class BackupController {
@@ -317,17 +318,8 @@ class BackupController {
return warnings;
}
- _utf8Decode(arrayBuffer) {
- try {
- return new TextDecoder('utf-8').decode(arrayBuffer);
- } catch (e) {
- const binaryString = String.fromCharCode.apply(null, new Uint8Array(arrayBuffer));
- return decodeURIComponent(escape(binaryString));
- }
- }
-
async _importSettingsFile(file) {
- const dataString = this._utf8Decode(await this._readFileArrayBuffer(file));
+ const dataString = StringUtil.arrayBufferUtf8Decode(await this._readFileArrayBuffer(file));
const data = JSON.parse(dataString);
// Type check