Edgewall Software

Ticket #1457 (closed defect: fixed)

Opened 4 years ago

Last modified 20 months 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@…

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@… 4 years ago.
Patch for correct encoding in changeset content

Change History

  Changed 4 years ago by anonymous

  • owner changed from jonas to cmlenz
  • milestone set to 0.9

  Changed 4 years ago by anonymous

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

  Changed 4 years ago by cmlenz

  • status changed from new to closed
  • resolution set to fixed

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.)

  Changed 4 years ago by vyt@…

Thank you very much!

  Changed 4 years ago by vyt@…

  • status changed from closed to reopened
  • resolution fixed deleted

I tried this changes and it doesn't work.

Changed 4 years ago by vyt@…

Patch for correct encoding in changeset content

  Changed 4 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.

  Changed 4 years ago by cmlenz

  • status changed from reopened to closed
  • resolution set to fixed

Should be fixed in [1696].

  Changed 4 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().

  Changed 4 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.

  Changed 4 years ago by vyt@…

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

  Changed 4 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.

  Changed 20 months ago by anonymous

  • status changed from closed to reopened
  • resolution fixed deleted

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.

follow-up: ↓ 14   Changed 20 months ago by anonymous

  • status changed from reopened to closed
  • resolution set to invalid

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.

in reply to: ↑ 13   Changed 20 months ago by cboos

  • status changed from closed to reopened
  • resolution invalid deleted

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.

  Changed 20 months ago by cboos

  • status changed from reopened to closed
  • resolution set to fixed

(re-closing as fixed)

Add/Change #1457 (Changeset contents doesn't encoded to UTF8)

Author



Change Properties
<Author field>
Action
as closed
Next status will be 'reopened'
to The owner will change from cmlenz. Next status will be 'closed'
 
Note: See TracTickets for help on using tickets.