This repository has been archived by the owner on Nov 10, 2022. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 244
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix: support Unicode in URL hash (#431)
- Loading branch information
1 parent
40a9885
commit 1e75d9e
Showing
2 changed files
with
19 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
"use strict"; | ||
|
||
define([], function() { | ||
|
||
// Provides conversion functions between a unicode string and a base64 string. | ||
// See also: https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/btoa#Unicode_strings | ||
return { | ||
encodeToBase64: function(text) { | ||
return window.btoa(unescape(encodeURIComponent(text))); | ||
}, | ||
|
||
decodeFromBase64: function(base64) { | ||
return decodeURIComponent(escape(window.atob(base64))); | ||
} | ||
}; | ||
}); |