Specify encoding in send_part_of_text_file
function
This commit is contained in:
parent
199fe29cf1
commit
ec747bef1d
@ -11,7 +11,7 @@ __author__ = "Davide Testa"
|
||||
__email__ = "davide@davte.it"
|
||||
__credits__ = ["Marco Origlia", "Nick Lee @Nickoala"]
|
||||
__license__ = "GNU General Public License v3.0"
|
||||
__version__ = "2.9.7"
|
||||
__version__ = "2.9.8"
|
||||
__maintainer__ = "Davide Testa"
|
||||
__contact__ = "t.me/davte"
|
||||
|
||||
|
@ -1666,7 +1666,8 @@ async def send_part_of_text_file(bot, chat_id, file_path, caption=None,
|
||||
file_name='File.txt', user_record=None,
|
||||
update=None,
|
||||
reversed_=True,
|
||||
limit=None):
|
||||
limit=None,
|
||||
encoding='utf-8'):
|
||||
"""Send `lines` lines of text file via `bot` in `chat_id`.
|
||||
|
||||
If `reversed`, read the file from last line.
|
||||
@ -1677,7 +1678,7 @@ async def send_part_of_text_file(bot, chat_id, file_path, caption=None,
|
||||
if update is None:
|
||||
update = dict()
|
||||
try:
|
||||
with open(file_path, 'r') as log_file:
|
||||
with open(file_path, 'r', encoding=encoding) as log_file:
|
||||
lines = log_file.readlines()
|
||||
if reversed_:
|
||||
lines = lines[::-1]
|
||||
|
Loading…
x
Reference in New Issue
Block a user