Uploaded image for project: 'PyLucene'
  1. PyLucene
  2. PYLUCENE-35

UnicodeEncodeError when a JavaException is raised

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • Arch Linux x86_64
      LANG=zh_CN.UTF-8

    Description

      When a javaException is raised and the stacktrace includes unicode characters, the stacktrace will not be printed. Instead, line 11 of _init_.py will raise a UnicodeEncodingError:

      !!! File "/usr/lib/python2.7/site-packages/lucene-4.9.0-py2.7-linux-x86_64.egg/lucene/_init.py", line 17, in __str_!!!
      !!! return "\n".join((super(JavaError, self)._str_(), " Java stacktrace:", str(writer)))!!!
      !!Unable to render embedded object: File ( 'ascii' codec can't encode characters in position 102-103: ordinal not in range(128)) not found.!!

      I found a workaround: change that line to
      return u"\n".join((unicode(super(JavaError, self)), u" Java stacktrace:", unicode(writer)))

      ,then it could print the correct stacktrace which contains unicode characters in file path.

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            Unassigned Unassigned
            htfy96 Vic Luo
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - 2h
                2h
                Remaining:
                Remaining Estimate - 2h
                2h
                Logged:
                Time Spent - Not Specified
                Not Specified

                Slack

                  Issue deployment