Use UTF-8 BOM

This commit is contained in:
Star Brilliant 2013-12-13 23:28:42 +08:00
parent 2ad8d81ba9
commit bd1e48eb34

View File

@ -528,7 +528,7 @@ def MarkCommentRow(rows, c, row):
def WriteASSHead(f, width, height, fontface, fontsize, alpha, styleid): def WriteASSHead(f, width, height, fontface, fontsize, alpha, styleid):
f.write( f.write(
'''\ufeff '''
[Script Info] [Script Info]
; Script generated by Danmaku2ASS ; Script generated by Danmaku2ASS
; https://github.com/m13253/danmaku2ass ; https://github.com/m13253/danmaku2ass
@ -625,7 +625,7 @@ def Danmaku2ASS(input_files, output_file, stage_width, stage_height, reserve_bla
comments = ReadComments(input_files, font_size) comments = ReadComments(input_files, font_size)
try: try:
if output_file: if output_file:
fo = ConvertToFile(output_file, 'w', encoding='utf-8', newline='\r\n') fo = ConvertToFile(output_file, 'w', encoding='utf-8-sig', newline='\r\n')
else: else:
fo = sys.stdout fo = sys.stdout
ProcessComments(comments, fo, stage_width, stage_height, reserve_blank, font_face, font_size, text_opaque, comment_duration, is_reduce_comments, progress_callback) ProcessComments(comments, fo, stage_width, stage_height, reserve_blank, font_face, font_size, text_opaque, comment_duration, is_reduce_comments, progress_callback)