From ddee219d5ab639a3ffb19f12cc32b7726f5c1b1b Mon Sep 17 00:00:00 2001 From: John Whitington Date: Fri, 17 Feb 2023 15:45:09 +0000 Subject: [PATCH] UTF8 mode finished --- cpdfjson.ml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cpdfjson.ml b/cpdfjson.ml index 9c56c14..792ea0e 100644 --- a/cpdfjson.ml +++ b/cpdfjson.ml @@ -217,6 +217,10 @@ and object_of_json = function | `Int n -> Pdf.Indirect n | `String s -> P.String s | `List objs -> P.Array (map object_of_json objs) + | `Assoc ["U", `String u] -> + begin try P.String (Pdftext.pdfdocstring_of_utf8 u) with + _ -> Printf.eprintf "Could not read UTF8 string %S\n" u; P.String u + end | `Assoc ["I", `Int i] -> P.Integer i | `Assoc ["F", `Float f] -> P.Real f | `Assoc ["N", `String n] -> P.Name n