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"
|
__email__ = "davide@davte.it"
|
||||||
__credits__ = ["Marco Origlia", "Nick Lee @Nickoala"]
|
__credits__ = ["Marco Origlia", "Nick Lee @Nickoala"]
|
||||||
__license__ = "GNU General Public License v3.0"
|
__license__ = "GNU General Public License v3.0"
|
||||||
__version__ = "2.9.7"
|
__version__ = "2.9.8"
|
||||||
__maintainer__ = "Davide Testa"
|
__maintainer__ = "Davide Testa"
|
||||||
__contact__ = "t.me/davte"
|
__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,
|
file_name='File.txt', user_record=None,
|
||||||
update=None,
|
update=None,
|
||||||
reversed_=True,
|
reversed_=True,
|
||||||
limit=None):
|
limit=None,
|
||||||
|
encoding='utf-8'):
|
||||||
"""Send `lines` lines of text file via `bot` in `chat_id`.
|
"""Send `lines` lines of text file via `bot` in `chat_id`.
|
||||||
|
|
||||||
If `reversed`, read the file from last line.
|
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:
|
if update is None:
|
||||||
update = dict()
|
update = dict()
|
||||||
try:
|
try:
|
||||||
with open(file_path, 'r') as log_file:
|
with open(file_path, 'r', encoding=encoding) as log_file:
|
||||||
lines = log_file.readlines()
|
lines = log_file.readlines()
|
||||||
if reversed_:
|
if reversed_:
|
||||||
lines = lines[::-1]
|
lines = lines[::-1]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user