diff --git a/ui-ngx/src/app/core/utils.ts b/ui-ngx/src/app/core/utils.ts index 348d4e7e9b..903e3d1e03 100644 --- a/ui-ngx/src/app/core/utils.ts +++ b/ui-ngx/src/app/core/utils.ts @@ -210,7 +210,13 @@ export function objToBase64(obj: any): string { } export function base64toString(b64Encoded: string): string { - return decodeURIComponent(atob(b64Encoded).split('').map((c) => '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2)).join('')); + const binary = atob(b64Encoded); + const bytes = Uint8Array.from(binary, c => c.charCodeAt(0)); + try { + return new TextDecoder('utf-8', { fatal: true }).decode(bytes); + } catch { + return new TextDecoder('iso-8859-1').decode(bytes); + } } export function objToBase64URI(obj: any): string { diff --git a/ui-ngx/src/app/shared/components/file-input.component.ts b/ui-ngx/src/app/shared/components/file-input.component.ts index 69945170da..29cfaccfb5 100644 --- a/ui-ngx/src/app/shared/components/file-input.component.ts +++ b/ui-ngx/src/app/shared/components/file-input.component.ts @@ -235,7 +235,7 @@ export class FileInputComponent extends PageComponent implements AfterViewInit, if (this.readAsBinary) { reader.readAsBinaryString(file.file); } else { - reader.readAsText(file.file); + reader.readAsText(file.file, 'ISO-8859-1'); } }); }