Edgewall Software
Modify

Ticket #1457 (closed defect: fixed)

Opened 7 years ago

Last modified 5 years ago

Changeset contents doesn't encoded to UTF8

Reported by: anonymous Owned by: cmlenz
Priority: normal Milestone: 0.9
Component: version control/changeset view Version: devel
Severity: minor Keywords: changeset charset encoding
Cc: vyt@…
Release Notes:
API Changes:

Description

I use trac trunk from 21 april 2005.

In changeset html output (and in diff format) content doesn't encoded to UTF8 as it does in browser module.

Attachments

trac.changeset_content_encoding.patch (2.6 KB) - added by vyt@… 7 years ago.
Patch for correct encoding in changeset content

Download all attachments as: .zip

Change History

comment:1 Changed 7 years ago by anonymous

  • Milestone set to 0.9
  • Owner changed from jonas to cmlenz

comment:2 Changed 7 years ago by anonymous

BTW, Changeset.py also should check for DISP_MAX_FILE_SIZE in html output (not in diff format).

comment:3 Changed 7 years ago by cmlenz

  • Resolution set to fixed
  • Status changed from new to closed

Fixed in [1660].

(I don't think there's a good way we can limit the size of the diff HTML output at this point.)

comment:4 Changed 7 years ago by vyt@…

Thank you very much!

comment:5 Changed 7 years ago by vyt@…

  • Resolution fixed deleted
  • Status changed from closed to reopened

I tried this changes and it doesn't work.

Changed 7 years ago by vyt@…

Patch for correct encoding in changeset content

comment:6 Changed 7 years ago by vyt@…

Attached patch work for me. It also affect
mimeview/api.py
I think what charset detection should be common code for Trac.

comment:7 Changed 7 years ago by cmlenz

  • Resolution set to fixed
  • Status changed from reopened to closed

Should be fixed in [1696].

comment:8 Changed 7 years ago by vyt@…

Yes, it works. But... It think what this code

charset = mimeview.get_charset(old_node.content_type) or default_charset
old_content = util.to_utf8(old_content, charset)

in many places in Trac could be simpler. Charset detection should be inside util.to_utf8().

comment:9 Changed 7 years ago by cmlenz

We don't want to add a dependency between trac.util and the trac.versioncontrol layer. That's why I didn't apply your patch directly.

comment:10 Changed 7 years ago by vyt@…

In other words, mimeview.get_charset() will be different for different scm backends ?

comment:11 Changed 7 years ago by cmlenz

No, the trac.mimeview package shouldn't know that the trac.versioncontrol package even exists. And get_charset should also work for things like attachments, of course.

comment:12 Changed 5 years ago by anonymous

  • Resolution fixed deleted
  • Status changed from closed to reopened

This is still broken for me in 0.10.3.1. Here is a screenshot (sorry I can't provide access to the trac website directly):

http://www.mukund.org/tmp/bad-display.png

I have set the default encoding to utf-8, but it still shows bad characters instead of the actual UTF-8 in various languages (japanese, hindi, tamil, etc.). In other programs such as editors, and on the website (it's a web project), I get the actual UTF-8 displayed correctly.

comment:13 follow-up: Changed 5 years ago by anonymous

  • Resolution set to invalid
  • Status changed from reopened to closed

Closing as invalid as this now works for me. Very very strange. Maybe the default encoding didn't take effect immediately. I have no idea how this started working again. As you can see from the screenshot, it was broken.

comment:14 in reply to: ↑ 13 Changed 5 years ago by cboos

  • Resolution invalid deleted
  • Status changed from closed to reopened

Replying to anonymous:

Maybe the default encoding didn't take effect immediately.

The change in the default encoding took effect immediately, but the changeset pages are cached by the browser. So the change in encoding was seen only after the page was forcibly reloaded or the diff options changed.

comment:15 Changed 5 years ago by cboos

  • Resolution set to fixed
  • Status changed from reopened to closed

(re-closing as fixed)

View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
The resolution will be deleted. Next status will be 'reopened'
to The owner will be changed from cmlenz. Next status will be 'closed'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.