#23 Only ASCII supported

closed-fixed
Edward Loper
5
2006-03-17
2003-07-30
Anonymous
No

Including Umlauts in coments results in exceptions
(character code not in range(0-128). Im using
restructuredtext and html output.

Discussion

  • Edward Loper
    Edward Loper
    2003-09-07

    • summary: Only ASCII supported?! --> Only ASCII supported
     
  • Edward Loper
    Edward Loper
    2003-09-07

    Logged In: YES
    user_id=195958

    Yes, I don't currently handle non-ascii input, because I
    haven't gotten around to learning about encodings. The
    necessary changes probably wouldn't be *that* difficult, if
    anyone wants to volunteer to make them (patches
    welcome!). Otherwise, they will have to wait until I get
    time to learn about encodings (probably several months at
    least).

     
  • Logged In: YES
    user_id=1053920

    CVS includes a patch to handle characters > 128.

    Detection of input encoding is still not complete, but it
    looks there is no problem for utf-8 and iso-8859-1.

     
  • Logged In: YES
    user_id=70861

    I tried using epydoc on django and always got a error when the file is written into the file.

    [...]
    [ 7/523] Writing django.utils.html-module.html
    Traceback (most recent call last):
    File "/usr/bin/epydoc", line 7, in ?
    cli()
    File "/usr/lib/python2.3/site-packages/epydoc/cli.py", line 116, in cli
    if options['action'] == 'html': _html(docmap, options)
    File "/usr/lib/python2.3/site-packages/epydoc/cli.py", line 616, in _html
    try: html_doc.write(options['target'], progress.report)
    File "/usr/lib/python2.3/site-packages/epydoc/html.py", line 487, in write
    progress_callback, uid.is_public(), uid, doc)
    File "/usr/lib/python2.3/site-packages/epydoc/html.py", line 591, in _write
    write_func(public, private, *args)
    File "/usr/lib/python2.3/site-packages/epydoc/html.py", line 744, in _write_module
    'Variable Summary')
    File "/usr/lib/python2.3/site-packages/epydoc/html.py", line 2411, in _write_var_summary
    self._write_var_summary_row(public, private, var, container)
    File "/usr/lib/python2.3/site-packages/epydoc/html.py", line 2482, in _write_var_summary_row
    private.write(str)
    UnicodeEncodeError: 'ascii' codec can't encode character u'\xe2' in position 332: ordinal not in range(128)

    I tried working on a patch, don't know if it's right, but fixes the problem for me.

    kindly regards
    daniel

     
  • Logged In: YES
    user_id=70861

    Patch, somehow i can't attach a file...

    --- html.py 2006-01-21 13:00:03.000000000 +0100
    +++ /usr/lib/python2.3/site-packages/epydoc/html.py 2006-01-21 22:11:59.000000000 +0100
    @@ -2480,6 +2480,6 @@

    str += '</td></tr>\n'
    - private.write(str)
    - if vuid.is_public(): public.write(str)
    + private.write(str.encode(self._encoding))
    + if vuid.is_public(): public.write(str.encode(self._encoding))

    def _write_var_details(self, public, private, container, vars,
    @@ -2519,6 +2519,6 @@
    str = self._var_details_entry(var, container)
    if str:
    - private.write(str)
    - if var.uid().is_public(): public.write(str)
    + private.write(str.encode(self._encoding))
    + if var.uid().is_public(): public.write(str.encode(self._encoding))

    # Write the footer

     
  • Logged In: YES
    user_id=1053920

    I checked in a different fix for this kind of problems. All
    variables whose value is pretty printed in an unicode
    string get correctly encoded.

    I tested on Django and now everything seems fine. If there
    were further problems, please also report the whole command
    line used.

    The patch is:

    --- C:\Documents and Settings\Daniele\Impostazioni
    locali\Temp\TCVb3dc.tmp\html.1.97.py Sat Jan 21 13:00:03
    2006
    +++ D:\sandbox\epydoc-sf\epydoc\src\epydoc\html.py Sun
    Jan 22 01:23:51 2006
    @@ -2653,6 +2653,9 @@
    else:
    try: vstr = markup.plaintext_to_html(repr(val))
    except: vstr = '...'
    +
    + if isinstance(vstr, unicode):
    + vstr = vstr.encode(self._encoding)

    # For the summary table, just return the value;
    don't
    # bother to word-wrap.

     
  • Edward Loper
    Edward Loper
    2006-03-17

    • status: open --> closed-fixed
     
  • Edward Loper
    Edward Loper
    2006-03-17

    Logged In: YES
    user_id=195958

    This is fixed in epydoc 3.0alpha (and at least partially
    fixed in the cvs version of epydoc 2.1)