CDR Tickets

Issue Number 4521
Summary Unicode encoding error in DISWithMarkup.py
Created 2018-09-17 11:00:54
Issue Type Bug
Submitted By Englisch, Volker (NIH/NCI) [C]
Assigned To Kline, Bob (NIH/NCI) [C]
Status Closed
Resolved 2019-12-03 14:17:44
Resolution Won't Fix
Path /home/bkline/backups/jira/ocecdr/issue.233156
Description

While I was looking through our log files I noticed a bug in the program DISWithMarkup.py that should be fixed. The error message in the file debug.log is this:

!4428 Tue Sep  4 15:38:43 2018: cdrcgi.unicodeToLatin1 got non-unicode string.  Stack trace follows
  File "D:\Inetpub\wwwroot\cgi-bin\cdr\DISWithMarkup.py", line 292, in <module>
    cdrcgi.sendPage(header + report + footer)
  File "D:\cdr\Lib\Python\cdrcgi.py", line 2460, in sendPage
    %25s""" %25 (redirect, textType, unicodeToLatin1(page))
  File "D:\cdr\Lib\Python\cdrcgi.py", line 2514, in unicodeToLatin1
    "Stack trace follows", stackTrace=True)
  File "D:\cdr\Lib\Python\cdr.py", line 4492, in logwrite
    traceback.print_stack(file=f)
Comment entered 2018-09-21 15:33:49 by Englisch, Volker (NIH/NCI) [C]

I was looking through the program to see if I could find out where the problem is. I was unable to recreate the failure on DEV even after including Spanish text within the DIS text and markup.
, please have users report whenever this report isn't showing up on PROD so that I can reproduce the behavior on DEV and fix it.

Comment entered 2019-07-16 14:22:47 by Englisch, Volker (NIH/NCI) [C]

I checked the log file again and noticed this error appearing again on Jun 7th and Jul 9th.

Comment entered 2019-12-03 09:10:16 by Kline, Bob (NIH/NCI) [C]

: This problem should not occur once Kepler has been deployed, assuming all of the CGI scripts get proper testing prior to the release deployment. The unicodeToLatin1() function no longer exists, and the sendPage() function which used to call it now results in an Exception if bytes are passed to it instead of a Unicode string, rather than just silently logging the problem. I recommend we close this ticket open separate tickets for any CGI scripts which slip through the Kepler testing cracks, if there are any.

Comment entered 2019-12-03 14:17:30 by Englisch, Volker (NIH/NCI) [C]

Yes, I agree.  I was hoping Python 3 would make this ticket mute. 

Closing issue.

Elapsed: 0:00:00.001327