1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-25 09:38:06 +02:00

[Editor] Correctly save a non-ascii alt text

This commit is contained in:
Calixte Denizet 2024-07-24 18:55:31 +02:00
parent cb737512de
commit c3065629ca
4 changed files with 67 additions and 27 deletions

View file

@ -613,6 +613,10 @@ function getNewAnnotationsMap(annotationStorage) {
return newAnnotationsByPage.size > 0 ? newAnnotationsByPage : null;
}
function stringToAsciiOrUTF16BE(str) {
return isAscii(str) ? str : stringToUTF16String(str, /* bigEndian = */ true);
}
function isAscii(str) {
return /^[\x00-\x7F]*$/.test(str);
}
@ -699,6 +703,7 @@ export {
readUint16,
readUint32,
recoverJsURL,
stringToAsciiOrUTF16BE,
stringToUTF16HexString,
stringToUTF16String,
toRomanNumerals,