mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-25 11:08:51 +01:00
use better mechanism for base64 decoding with unicode characters (#172445)
Fixes #172441
This commit is contained in:
committed by
GitHub
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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user