mirror of
https://github.com/Microsoft/vscode
synced 2024-09-13 13:46:13 +00:00
use better mechanism for base64 decoding with unicode characters (#172445)
Fixes #172441
This commit is contained in:
parent
88e4667480
commit
7fc1f6aacb
|
@ -8,6 +8,10 @@ export function base64Encode(text: string): string {
|
|||
}
|
||||
|
||||
export function base64Decode(text: string): string {
|
||||
const data = atob(text);
|
||||
return data;
|
||||
// modification of https://stackoverflow.com/a/38552302
|
||||
const replacedCharacters = text.replace(/-/g, '+').replace(/_/g, '/');
|
||||
const decodedText = decodeURIComponent(atob(replacedCharacters).split('').map(function (c) {
|
||||
return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);
|
||||
}).join(''));
|
||||
return decodedText;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue