#135 — 'UnicodeError' occured in Japanese

by (anonymous) — last modified Jan 05, 2009 09:29 AM
State Resolved
Version:
Area Functionality
Issue type Bug
Severity Medium
Submitted by (anonymous)
Submitted on Jun 21, 2007
Responsible Maurits van Rees
Target release: 1.1
I'm very happy to use 'poi' as issue trakcer in our office. Usually 'poi' works OK in Japanese, however, sometimes we get 'UnicodeError', when we subumit a new issue. Here is example of error message.

-----
UnicodeError

Unable to decode input data. Tried the following encodings: 'utf-8'. (UnicodeDecodeError: 'utf8' codec can't decode bytes in position 480-482: invalid data)
-----

We can submit same text as normal plone page, but we can't submit as 'poi' issue.
Is there any way to solve this problem?

Zope : 2.8.8
plone : 2.1.4
poi : 1.0 RC2

Thank you.
Added by (anonymous) on Jun 23, 2007 10:35 AM
Target release: 1.1None
Responsible manager: maurits(UNASSIGNED)
We solve this problem as follows. Change 'PoiIssue.py' line 412-.

###### original ###############

    def Description(self):
        """If a description is set manually, return that. Else returns the first
        200 characters (defined in config.py) of the 'details' field.
        """
        explicit = self.getField('description').get(self)
        if explicit:
            return explicit
        else:
            details = self.getRawDetails()
            if len(details) > DESCRIPTION_LENGTH:
                return self.getDetails()[:DESCRIPTION_LENGTH] + "..."
            else:
                return details

###### Change to ###############


     def Description(self):
         """If a description is set manually, return that. Else returns the first
         200 characters (defined in config.py) of the 'details' field.
         """
         explicit = self.getField('description').get(self)
         if explicit:
             return explicit
         else:
             ##details = self.getRawDetails()
             ##if len(details) > DESCRIPTION_LENGTH:
             ## return self.getDetails()[:DESCRIPTION_LENGTH] + "..."
             ##else:
             ## return details
             details = self.getDetails()
             if type(details) is not unicode:
                 details = unicode(details)
             if len(details) > DESCRIPTION_LENGTH:
                 return details[:DESCRIPTION_LENGTH] + "..."
             else:
                 return details


###################################
Added by Maurits van Rees on Nov 14, 2007 08:49 PM
Issue state: unconfirmedresolved
Target release: None1.1
Responsible manager: (UNASSIGNED)maurits
I do not see this error in my browser. That might depend on some settings in the browser of course.

I added a variant of your patch to trunk in r53855. That should solve it, but please test if that is correct. Thanks!
Added by Maurits van Rees on Mar 04, 2008 10:37 PM
I hope the original author (who was anonymous) reads this.

When you have this patch installed (either your own code or the official code in Poi 1.1) is it working for you? Are you now maybe running into UnicodeEncodeErrors when you recreate the catalog or reindex a single Issue or all Issues? I am seeing that currently for issues with non ascii in them.

No responses can be added.