mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-10-25 02:07:09 -06:00
A PDF or PDF-compatible .ai saved with Preserve Editing carries the native document as an embedded file, with a hash of its pages at the end of the file's /Desc. The import read /Desc with from_utf8_lossy and looked for "hash ". /Desc is a PDF text string, which may be written as UTF-16BE with a byte order mark (ISO 32000-1 7.9.2.2). Written that way it holds no UTF-8 "hash ", so the import found no hash, took the editing data as intact and reopened the native document with no warning, even after another app had changed the pages. /Desc is now read with text_string, the importer's decoder for text strings, so the hash is found in UTF-16BE, UTF-8 and PDFDocEncoding. Changed pages open as artwork with the "changed in another app" warning. The embedded file's /UF and /F names are decoded the same way, so editing data named only in UTF-16BE is found. A /Desc without a hash is still trusted, as before.