diff -ur trac-orig/Changeset.py trac/Changeset.py
--- trac-orig/Changeset.py	2005-05-17 16:07:02 +0400
+++ trac/Changeset.py	2005-05-18 15:42:53 +0400
@@ -200,8 +200,8 @@
                         context = int(option[2:])
                         break
                 tabwidth = int(self.config.get('diff', 'tab_width'))
-                changes = hdf_diff(util.to_utf8(old_content).splitlines(),
-                                   util.to_utf8(new_content).splitlines(),
+                changes = hdf_diff(util.to_utf8(old_content,mimeview.get_charset(self, old_node)).splitlines(),
+                                   util.to_utf8(new_content,mimeview.get_charset(self, new_node)).splitlines(),
                                    context, tabwidth,
                                    ignore_blank_lines='-B' in diff_options[1],
                                    ignore_case='-i' in diff_options[1],
@@ -234,12 +234,12 @@
             new_content = old_content = ''
             new_node_info = old_node_info = ('','')
             if old_node:
-                old_content = util.to_utf8(old_node.get_content().read())
+                old_content = util.to_utf8(old_node.get_content().read(),mimeview.get_charset(self, old_node))
                 old_node_info = (old_node.path, old_node.rev)
             if mimeview.is_binary(old_content):
                 continue
             if new_node:
-                new_content = util.to_utf8(new_node.get_content().read())
+                new_content = util.to_utf8(new_node.get_content().read(),mimeview.get_charset(self, new_node))
                 new_node_info = (new_node.path, new_node.rev)
             if old_content != new_content:
                 context = 3
diff -ur trac-orig/mimeview/api.py trac/mimeview/api.py
--- trac-orig/mimeview/api.py	2005-05-17 16:07:01 +0400
+++ trac/mimeview/api.py	2005-05-18 15:40:41 +0400
@@ -24,7 +24,7 @@
 
 from trac.core import *
 
-__all__ = ['get_mimetype', 'is_binary', 'Mimeview']
+__all__ = ['get_mimetype', 'is_binary', 'Mimeview', 'get_charset']
 
 MIME_MAP = {
     'css':'text/css',
@@ -99,6 +99,18 @@
     except:
         return None
 
+def get_charset(env, node):
+    """Get charset for node content"""
+    mime_type = node.content_type
+    if not mime_type or mime_type == 'application/octet-stream':
+	mime_type = get_mimetype(node.name) or mime_type or 'text/plain'
+    ctpos = mime_type.find('charset=')
+    if ctpos >= 0:
+        charset = mime_type[ctpos + 8:]
+    else:
+        charset = env.config.get('trac', 'default_charset')
+    return charset
+
 def is_binary(str):
     """
     Try to detect content by checking the first thousand bytes for zeroes.

