diff options
Diffstat (limited to 'bsie/reader')
-rw-r--r-- | bsie/reader/document/__init__.py | 4 | ||||
-rw-r--r-- | bsie/reader/document/_plain.py | 3 |
2 files changed, 4 insertions, 3 deletions
diff --git a/bsie/reader/document/__init__.py b/bsie/reader/document/__init__.py index 4ae3613..824ad86 100644 --- a/bsie/reader/document/__init__.py +++ b/bsie/reader/document/__init__.py @@ -17,13 +17,13 @@ _FILE_FORMAT_READERS: typing.Sequence[str] = ( # exports __all__: typing.Sequence[str] = ( - 'Document' + 'Document', ) ## code ## -class Document(chain.ReaderChain[typing.Sequence[str]]): +class Document(chain.ReaderChain[typing.Sequence[str]]): # pylint: disable=too-few-public-methods """Read paragraphs from a text file.""" def __init__(self, cfg: typing.Optional[typing.Any] = None): diff --git a/bsie/reader/document/_plain.py b/bsie/reader/document/_plain.py index a589265..8ea3c43 100644 --- a/bsie/reader/document/_plain.py +++ b/bsie/reader/document/_plain.py @@ -20,6 +20,7 @@ __all__: typing.Sequence[str] = ( ## code ## class Plain(base.Reader): + """Read paragraphs (seperated by newline) from a plain text file.""" _match: filematcher.Matcher @@ -32,7 +33,7 @@ class Plain(base.Reader): raise errors.UnsupportedFileFormatError(path) # open file in text mode - with open(path, 'rt') as ifile: + with open(path, 'rt', encoding='UTF-8') as ifile: return [line.strip() for line in ifile.read().split('\n') if len(line.strip()) > 0] ## EOF ## |