Ticket #1719 (reopened defect)

Opened 2 years ago

Last modified 11 months ago

Encoding trouble

Reported by: anonymous Assigned to: jmt4b04d4v
Priority: normal Component: TracSpanishTranslation
Severity: normal Keywords: UnicodeDecodeError
Cc: Trac Release: 0.10

Description

Encoding trouble with the applying of the patch in the authentication process. The backtrace is the following:

Traceback (most recent call last):

File "/usr/lib/python2.4/site-packages/trac/web/main.py", line 406, in dispatch_request

dispatcher.dispatch(req)

File "/usr/lib/python2.4/site-packages/trac/web/main.py", line 259, in dispatch

raise HTTPInternalError(e.message)

File "/usr/lib/python2.4/site-packages/trac/web/api.py", line 47, in call

Exception.init(self, '%s %s (%s)' % (self.code, self.reason,

UnicodeEncodeError?: 'ascii' codec can't encode character u'\xf3' in position 12: ordinal not in range(128)

in the login module. This happen with many exceptions. using Trac 0.10.4

Attachments

Change History

(in reply to: ↑ description ) 07/04/07 18:24:38 changed by jmt4b04d4v

  • keywords set to needinfo.

Replying to anonymous:

Encoding trouble with the applying of the patch in the authentication process. The backtrace is the following:
...

Strange, file is encoded in UTF-8 (as I already had encoding problems prior to submit first revision of patch file), I'll take a look, thanks for reporting.

...
in the login module. This happen with many exceptions. using Trac 0.10.4

Are you applying patch to Trac 0.10.4 release? (maybe trac-0.10.4 r5236).

Patch was created for current 0.10-stable branch (started at Trac 0.10.5dev r5702, changes up to r5644) and will be maintained for that target only.

Taking a look at Changes from tags/trac-0.10.4 at r5236 to branches/0.10-stable at r5803, chances are that patch won't apply correctly to Trac 0.10.4 release.

Could you try with Trac 0.10 stable branch? (get a working copy and apply patch to that).

As for now, I'd suggest to work (get a working copy) in a linux box. A windows subversion client will complain when applying patch (EOLs).

07/10/07 14:15:44 changed by jmt4b04d4v

Today I tested latest patches (python and templates r2343) against Trac 0.10-stable r5822:

root@PCDCOM:/home/jmtaboadav/tmpTrac/tmpTracSp# svn info
Path: .
URL: https://svn.edgewall.com/repos/trac/branches/0.10-stable
Repository Root: https://svn.edgewall.com/repos/trac
Repository UUID: af82e41b-90c4-0310-8c96-b1721e28e2e2
Revision: 5822
Node Kind: directory
Schedule: normal
Last Changed Author: cboos
Last Changed Rev: 5644
Last Changed Date: 2007-06-08 07:33:12 -0400 (Fri, 08 Jun 2007)
root@PCDCOM:/home/jmtaboadav/tmpTrac/tmpTracSp# svn info ../tmpTracTr/tracspanishtranslation/
Path: ../tmpTracTr/tracspanishtranslation
URL: https://trac-hacks.org/svn/tracspanishtranslation
Repository Root: https://trac-hacks.org/svn
Repository UUID: 7322e99d-02ea-0310-aa39-e9a107903beb
Revision: 2447
Node Kind: directory
Schedule: normal
Last Changed Author: jmt4b04d4v
Last Changed Rev: 2343
Last Changed Date: 2007-06-26 18:35:15 -0400 (Tue, 26 Jun 2007)

And found no problem. I will post patch procedure in TracSpanishTranslation soon to avoid confusion.

Trac Team is currently busy with 0.11 release, and 0.10.5 is planned for No date set so I'm going to create patches for 0.10.4 release (trac-0.10.4 r5236). Wait for them.

(in reply to: ↑ description ; follow-up: ↓ 4 ) 07/10/07 18:45:45 changed by jmt4b04d4v

  • keywords changed from needinfo to UnicodeDecodeError.
  • status changed from new to assigned.

Replying to anonymous:

Encoding trouble with the applying of the patch in the authentication process. The backtrace is the following:

Traceback (most recent call last):
File "/usr/lib/python2.4/site-packages/trac/web/main.py", line 406, in dispatch_request
dispatcher.dispatch(req)
File "/usr/lib/python2.4/site-packages/trac/web/main.py", line 259, in dispatch
raise HTTPInternalError(e.message)
File "/usr/lib/python2.4/site-packages/trac/web/api.py", line 47, in call
Exception.init(self, '%s %s (%s)' % (self.code, self.reason,
UnicodeEncodeError?: 'ascii' codec can't encode character u'\xf3' in position 12: ordinal not in range(128)

in the login module. This happen with many exceptions. using Trac 0.10.4

You were right all the time, I found another errors related with UnicodeEncodeError, it seems that some strings are not handled as unicode in Trac internals.

I'm going to search another potential troubles related with UnicodeDecodeError. At least 3 more bugs were found related with the same issue.

Thanks again for reporting!

(in reply to: ↑ 3 ) 07/11/07 15:48:48 changed by jmt4b04d4v

Replying to jmt4b04d4v:

You were right all the time, I found another errors related with UnicodeEncodeError, it seems that some strings are not handled as unicode in Trac internals.

Mmmm, certainly, I'm still a Python newbie, ... I've just learn how to manipulate string conversion in Python (related to Unicode).

There are places where I must do an explicit unicode transformation, that I missed. It's not handled in Trac internals because I'm the one who has introduced non-ascii characteres in Python code.

I'm going to search another potential troubles related with UnicodeDecodeError. At least 3 more bugs were found related with the same issue.

Indeed, found 8 bugs (included reported one) until found root of problems, all related with string interpolation within my non-ascii introduced strings.

Work in progress...

(follow-up: ↓ 7 ) 07/12/07 07:27:35 changed by cboos

See also #T5684

07/12/07 15:52:12 changed by jmt4b04d4v

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

(In [2461]) closes #1719: Encoding trouble

  • Added string manipulation of Unicode strings everywhere I introduced non-ascii characteres:
    • unicode($UNICODE_STRING, 'utf-8') - in strings that appear in the web UI.
    • unicode($CADENA_UNICODE, 'utf-8').encode('utf-8') - in strings that go to the STDOUT, for tracd and trac-admin (this doen't work really, I don't know why).
  • Fix some miss-translations:
    • 0.10-stable/trac/ticket/web_ui.py#L416
      • by - por
    • 0.10-stable/trac/Timeline.py#L195
      • RSS Feed - Fuente en formato RSS
    • 0.10-stable/templates/newticket.cs#L10
      • Crer - Crear
    • 0.10-stable/templates/newticket.cs#L22
      • Breve descripci?\195?\179n - Descripci?\195?\179n breve
    • 0.10-stable/templates/about.cs#L91 , 0.10-stable/trac/env.py#L83
      • open source - c?\195?\179digo abierto
    • 0.10-stable/templates/changeset.cs#L135
      • from - de
    • 0.10-stable/templates/changeset.cs#L180
      • added - a?\195?\177adido
    • 0.10-stable/templates/changeset.cs#L182
      • deleted - eliminado
    • 0.10-stable/templates/changeset.cs#L184
      • copied - copiado
    • 0.10-stable/templates/changeset.cs#L186
      • moved - movido
    • 0.10-stable/templates/changeset.cs#L188
      • modified - modificado

(in reply to: ↑ 5 ; follow-up: ↓ 8 ) 07/12/07 16:11:31 changed by anonymous

Replying to cboos:

See also #T5684

Thanks for feedback. I read this late and took a larger way.

(in reply to: ↑ 7 ) 07/12/07 16:34:50 changed by jmt4b04d4v

Replying to anonymous:

Replying to cboos:

See also #T5684

Thanks for feedback. I read this late and took a larger way.

Forgot to login, just for clarifying.

02/18/08 09:13:37 changed by rperezm@uci.cu

  • status changed from closed to reopened.
  • resolution deleted.

When the patch for Trac 0.10.4 will be available ?


Add/Change #1719 (Encoding trouble)




Change Properties
Action