Answer the question
In order to leave comments, you need to log in
How to encrypt string to utf-8-bom in python?
There is such a function. I need to convert a small file from UTF-8 to UTF-8 WITH BOM
def encod_utf8_bom(self, path_on_file: str):
file = open(path_on_file, encoding='utf-8', mode='r')
encoding_file = [line.encode('utf-8-bom') for line in file]
file.close()
file = open(path_on_file, 'wb')
[file.write(line) for line in encoding_file]
file.close()
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question