Raise KeyError when name in name2unicode is not of type str (#733)
* Raise KeyError when name in name2unicode is not of type str * Add CHANGELOG.mdpull/732/head^2
parent
e27cd54aff
commit
782368b911
|
@ -6,10 +6,13 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
### Fixes
|
### Fixed
|
||||||
|
|
||||||
|
- `TypeError` in encodingdb.py when name of unicode is not
|
||||||
|
str ([#733](https://github.com/pdfminer/pdfminer.six/pull/733))
|
||||||
- `TypeError` in HTMLConverter when using a bytes fontname ([#734](https://github.com/pdfminer/pdfminer.six/pull/734))
|
- `TypeError` in HTMLConverter when using a bytes fontname ([#734](https://github.com/pdfminer/pdfminer.six/pull/734))
|
||||||
|
|
||||||
|
|
||||||
## [20220319]
|
## [20220319]
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
|
@ -25,6 +25,12 @@ def name2unicode(name: str) -> str:
|
||||||
:returns unicode character if name resembles something,
|
:returns unicode character if name resembles something,
|
||||||
otherwise a KeyError
|
otherwise a KeyError
|
||||||
"""
|
"""
|
||||||
|
if not isinstance(name, str):
|
||||||
|
raise KeyError(
|
||||||
|
'Could not convert unicode name "%s" to character because '
|
||||||
|
"it should be of type str but is of type %s" % (name, type(name))
|
||||||
|
)
|
||||||
|
|
||||||
name = name.split(".")[0]
|
name = name.split(".")[0]
|
||||||
components = name.split("_")
|
components = name.split("_")
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue