Ticket #3073 (reopened enhancement)

Opened 8 months ago

Last modified 1 month ago

boacelric

Reported by: zregvart@gmail.com Assigned to: cboos
Priority: lowest Component: DrProjectPatch
Severity: minor Keywords: boacelric
Cc: boacelric Trac Release: 0.8

Description

Hi, I upgraded to latest for Trac 0.10 and found that URL links no longer support international characters. The changeset, as I see it, that caused this is [3382].

The exception:

Traceback (most recent call last):
  File "/usr/local/lib/python2.5/site-packages/trac/web/main.py", line 406, in dispatch_request
    dispatcher.dispatch(req)
  File "/usr/local/lib/python2.5/site-packages/trac/web/main.py", line 237, in dispatch
    resp = chosen_handler.process_request(req)
  File "/usr/local/lib/python2.5/site-packages/trac/wiki/web_ui.py", line 111, in process_request
    self._render_editor(req, db, page, preview=True)
  File "/usr/local/lib/python2.5/site-packages/trac/wiki/web_ui.py", line 385, in _render_editor
    info['page_html'] = wiki_to_html(page.text, self.env, req, db)
  File "/usr/local/lib/python2.5/site-packages/trac/wiki/formatter.py", line 1001, in wiki_to_html
    Formatter(env, req, absurls, db).format(wikitext, out, escape_newlines)
  File "/usr/local/lib/python2.5/site-packages/trac/wiki/formatter.py", line 795, in format
    self.handle_code_block(line)
  File "/usr/local/lib/python2.5/site-packages/trac/wiki/formatter.py", line 735, in handle_code_block
    self.req, self.code_text)))
  File "/usr/local/lib/python2.5/site-packages/trac/wiki/formatter.py", line 114, in process
    text = self.processor(req, text)
  File "/usr/local/lib/python2.5/site-packages/trac/wiki/formatter.py", line 102, in _macro_processor
    return self.macro_provider.render_macro(req, self.name, text)
  File "build/bdist.freebsd-6.3-STABLE-i386/egg/graphviz/graphviz.py", line 206, in render_macro
    content = re.sub(r'URL="(.*?)"', self.expand_wiki_links, content)
  File "/usr/local/lib/python2.5/re.py", line 150, in sub
    return _compile(pattern, 0).sub(repl, string, count)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc5 in position 73: ordinal not in range(128)

FreeBSD, Trac 0.10.4, Apache 2.2, mod_python 3.3.1, python 2.5.2

Attachments

traclinks-unicode-support.patch (4.2 kB) - added by cboos on 09/26/08 06:23:12.
More robust unicode support

Change History

09/21/08 15:15:34 changed by franck34

Same here. Probably depending on the server configuration. Here is my patch :

add

        url      = url.encode('utf-8')

just after

        url      = href and href.groups()[0] or html_url

in function

    def expand_wiki_links(self, match):

09/26/08 06:23:12 changed by cboos

  • attachment traclinks-unicode-support.patch added.

More robust unicode support

09/26/08 06:32:18 changed by cboos

  • release changed from 0.10 to 0.11.

I just attached a patch for the 0.11 version of the plugin.

10/06/08 12:10:53 changed by cboos

  • owner changed from pkropf to cboos.

10/06/08 12:11:54 changed by cboos

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

In [4395], some additional changes concerning expand_wiki_links and better unicode support were applied.

12/02/08 05:55:37 changed by eltvizelt

  • status changed from closed to reopened.
  • severity changed from normal to minor.
  • cc set to boacelric.
  • type changed from defect to enhancement.
  • component changed from GraphvizPlugin to DrProjectPatch.
  • summary changed from UnicodeDecodeError re.sub(r'URL="(.*?)"', self.expand_wiki_links, content) to boacelric.
  • priority changed from normal to lowest.
  • release changed from 0.11 to 0.8.
  • keywords changed from UnicodeDecodeError URL to boacelric.
  • resolution deleted.

chilitarico


Add/Change #3073 (boacelric)




Change Properties
Action