
noreply at edgewall
Sep 15, 2006, 2:39 AM
Post #19 of 25
(5236 views)
Permalink
|
|
Re: [The Trac Project] #1310: trac-post-commit-hook and codepages
[In reply to]
|
|
#1310: trac-post-commit-hook and codepages ---------------------------+------------------------------------------------ Reporter: GregZ | Owner: cboos Type: defect | Status: new Priority: normal | Milestone: 0.10 Component: browser | Version: 0.9.3 Severity: minor | Resolution: Keywords: utf-8 unicode | ---------------------------+------------------------------------------------ Changes (by cboos): * owner: jonas => cboos * priority: low => normal * status: reopened => new * milestone: => 0.10 Comment: He, not sure that #3732 is really a duplicate of this one, as I wrote a patch that would have fixed #3732, I believe. We'll see. Can you try out the following patch? (be careful, it's for 0.10, don't apply on 0.9) {{{ Index: trac-post-commit-hook =================================================================== --- trac-post-commit-hook (revision 3720) +++ trac-post-commit-hook (working copy) @@ -78,6 +78,7 @@ from trac.ticket import Ticket from trac.ticket.web_ui import TicketModule # TODO: move grouped_changelog_entries to model.py +from trac.util.text import to_unicode from trac.web.href import Href try: @@ -101,6 +102,8 @@ help='The user who is responsible for this action') parser.add_option('-m', '--msg', dest='msg', help='The log message to search.') +parser.add_option('-c', '--encoding', dest='encoding', + help='The encoding used by the log message.') parser.add_option('-s', '--siteurl', dest='url', help='The base URL to the project\'s trac website (to which ' '/ticket/## is appended). If this is not specified, ' @@ -132,7 +135,9 @@ 'see': '_cmdRefs'} def __init__(self, project=options.project, author=options.user, - rev=options.rev, msg=options.msg, url=options.url): + rev=options.rev, msg=options.msg, url=options.url, + encoding=options.encoding): + msg = to_unicode(msg, encoding) self.author = author self.rev = rev self.msg = "(In [%s]) %s" % (rev, msg) }}} As normally ''I think'' you'd get UTF-8 strings when Subversion calls the post-commit hook, the `-c/--encoding` option shouldn't be needed. However it can be useful when testing the script from the command line, or if for some reason the post-commit hook is actually given the message with a different encoding. -- Ticket URL: <http://trac.edgewall.org/ticket/1310#comment:18> The Trac Project <http://trac.edgewall.org/> --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Trac Tickets" group. To post to this group, send email to trac-tickets [at] googlegroups To unsubscribe from this group, send email to trac-tickets-unsubscribe [at] googlegroups For more options, visit this group at http://groups.google.se/group/trac-tickets -~----------~----~----~----~------~----~------~--~---
|