Support RFC 6855 / RFC 5738 (UTF8)

This commit is contained in:
djmaze 2021-11-22 21:01:30 +01:00
parent c9a497eb9d
commit 299ec7faf8
25 changed files with 249 additions and 505 deletions

View file

@ -19,10 +19,19 @@ import { AbstractFetchRemote } from 'Remote/AbstractFetch';
import { FolderCollectionModel } from 'Model/FolderCollection';
const urlSafeJSON = data => btoa(JSON.stringify(data))
// unescape(encodeURIComponent()) makes the UTF-16 DOMString to an UTF-8 string
const urlSafeJSON = data => btoa(unescape(encodeURIComponent(JSON.stringify(data))))
.replace(/\+/g, '-')
.replace(/\//g, '_')
.replace(/=+$/, '');
/* Withous deprecated 'unescape':
const urlSafeJSON = data => btoa(encodeURIComponent(JSON.stringify(data)).replace(
/%([0-9A-F]{2})/g, (match, p1) => String.fromCharCode('0x' + p1)
))
.replace(/\+/g, '-')
.replace(/\//g, '_')
.replace(/=+$/, '');
*/
class RemoteUserFetch extends AbstractFetchRemote {