@@ -1598,7 +1598,7 @@ def _line_pair_iterator():
15981598
15991599<head>
16001600 <meta http-equiv="Content-Type"
1601- content="text/html; charset=ISO-8859-1 " />
1601+ content="text/html; charset=%(charset)s " />
16021602 <title></title>
16031603 <style type="text/css">%(styles)s
16041604 </style>
@@ -1685,8 +1685,8 @@ def __init__(self,tabsize=8,wrapcolumn=None,linejunk=None,
16851685 self ._linejunk = linejunk
16861686 self ._charjunk = charjunk
16871687
1688- def make_file (self ,fromlines ,tolines ,fromdesc = '' ,todesc = '' , context = False ,
1689- numlines = 5 ):
1688+ def make_file (self , fromlines , tolines , fromdesc = '' , todesc = '' ,
1689+ context = False , numlines = 5 , * , charset = 'utf-8' ):
16901690 """Returns HTML file of side by side comparison with change highlights
16911691
16921692 Arguments:
@@ -1701,13 +1701,16 @@ def make_file(self,fromlines,tolines,fromdesc='',todesc='',context=False,
17011701 When context is False, controls the number of lines to place
17021702 the "next" link anchors before the next change (so click of
17031703 "next" link jumps to just before the change).
1704+ charset -- charset of the HTML document
17041705 """
17051706
1706- return self ._file_template % dict (
1707- styles = self ._styles ,
1708- legend = self ._legend ,
1709- table = self .make_table (fromlines ,tolines ,fromdesc ,todesc ,
1710- context = context ,numlines = numlines ))
1707+ return (self ._file_template % dict (
1708+ styles = self ._styles ,
1709+ legend = self ._legend ,
1710+ table = self .make_table (fromlines , tolines , fromdesc , todesc ,
1711+ context = context , numlines = numlines ),
1712+ charset = charset
1713+ )).encode (charset , 'xmlcharrefreplace' ).decode (charset )
17111714
17121715 def _tab_newline_replace (self ,fromlines ,tolines ):
17131716 """Returns from/to line lists with tabs expanded and newlines removed.
0 commit comments