mirror of
https://github.com/jsvine/pdfplumber.git
synced 2026-08-29 08:34:23 +08:00
rename warn_unicode_error to raise_unicode_errors for clarity
additionally change the default accordingly
This commit is contained in:
+1
-1
@@ -310,7 +310,7 @@ class Page(Container):
|
||||
try:
|
||||
extras[k] = v.decode("utf-16")
|
||||
except UnicodeDecodeError:
|
||||
if not self.pdf.warn_unicode_error:
|
||||
if self.pdf.raise_unicode_errors:
|
||||
raise
|
||||
warn(f"Could not decode {k} for annotation. {k} will be missing.")
|
||||
|
||||
|
||||
+4
-4
@@ -35,7 +35,7 @@ class PDF(Container):
|
||||
password: Optional[str] = None,
|
||||
strict_metadata: bool = False,
|
||||
unicode_norm: Optional[Literal["NFC", "NFKC", "NFD", "NFKD"]] = None,
|
||||
warn_unicode_error: bool = False,
|
||||
raise_unicode_errors: bool = True,
|
||||
):
|
||||
self.stream = stream
|
||||
self.stream_is_external = stream_is_external
|
||||
@@ -44,7 +44,7 @@ class PDF(Container):
|
||||
self.laparams = None if laparams is None else LAParams(**laparams)
|
||||
self.password = password
|
||||
self.unicode_norm = unicode_norm
|
||||
self.warn_unicode_error = warn_unicode_error
|
||||
self.raise_unicode_errors = raise_unicode_errors
|
||||
|
||||
self.doc = PDFDocument(PDFParser(stream), password=password or "")
|
||||
self.rsrcmgr = PDFResourceManager()
|
||||
@@ -78,7 +78,7 @@ class PDF(Container):
|
||||
repair: bool = False,
|
||||
gs_path: Optional[Union[str, pathlib.Path]] = None,
|
||||
repair_setting: T_repair_setting = "default",
|
||||
warn_unicode_error: bool = False,
|
||||
raise_unicode_errors: bool = True,
|
||||
) -> "PDF":
|
||||
|
||||
stream: Union[BufferedReader, BytesIO]
|
||||
@@ -110,7 +110,7 @@ class PDF(Container):
|
||||
strict_metadata=strict_metadata,
|
||||
unicode_norm=unicode_norm,
|
||||
stream_is_external=stream_is_external,
|
||||
warn_unicode_error=warn_unicode_error,
|
||||
raise_unicode_errors=raise_unicode_errors,
|
||||
)
|
||||
|
||||
except PSException:
|
||||
|
||||
Reference in New Issue
Block a user