Closed
Bug 1087248
Opened 10 years ago
Closed 10 years ago
[mozlog] Fix encoding for debug in HTML formatter such as page source
Categories
(Testing :: Mozbase, defect)
Testing
Mozbase
Tracking
(Not tracked)
RESOLVED
FIXED
mozilla36
People
(Reporter: davehunt, Assigned: davehunt)
References
Details
Attachments
(3 files, 1 obsolete file)
The HTML formatter currently fails to output debug if it contains characters outside of the default encoding. The page source in B2G often contains such characters.
Assignee | ||
Comment 1•10 years ago
|
||
This is how we fixed this in the HTML report currently generated by the Marionette test runner. I'm open to other suggestions.
Attachment #8509485 -
Flags: review?(james)
Comment 2•10 years ago
|
||
Comment on attachment 8509485 [details] [diff] [review]
Fix encoding to utf-8. v1.0
Review of attachment 8509485 [details] [diff] [review]:
-----------------------------------------------------------------
::: testing/mozbase/mozlog/mozlog/structured/formatters/html/html.py
@@ +96,5 @@
>
> def make_result_html(self, data):
> + # change default encoding to avoid encoding problem for page source
> + reload(sys)
> + sys.setdefaultencoding('utf-8')
This is terrifying ;)
I think we should try to track down the places that are assuming ascii and actually fox them to be explicit. If you send me a log file that breaks I'll help with this.
Attachment #8509485 -
Flags: review?(james) → review-
Assignee | ||
Comment 3•10 years ago
|
||
(In reply to James Graham [:jgraham] from comment #2)
> I think we should try to track down the places that are assuming ascii and
> actually fox them to be explicit. If you send me a log file that breaks I'll
> help with this.
I was hoping you'd say that. Traceback and page source that caused it coming up!
Assignee | ||
Comment 4•10 years ago
|
||
Assignee | ||
Comment 5•10 years ago
|
||
Assignee | ||
Updated•10 years ago
|
Flags: needinfo?(james)
Comment 6•10 years ago
|
||
It looks like the content argument in base64.b64encode(content) must be a unicode string. If you instead pass in content.encode("utf8") I expect it will work.
Flags: needinfo?(james)
Assignee | ||
Comment 7•10 years ago
|
||
(In reply to James Graham [:jgraham] from comment #6)
> It looks like the content argument in base64.b64encode(content) must be a
> unicode string. If you instead pass in content.encode("utf8") I expect it
> will work.
Yep, that works well. Thanks!
Attachment #8509485 -
Attachment is obsolete: true
Attachment #8511943 -
Flags: review?(james)
Updated•10 years ago
|
Attachment #8511943 -
Flags: review?(james) → review+
Assignee | ||
Updated•10 years ago
|
Keywords: checkin-needed
Comment 8•10 years ago
|
||
Keywords: checkin-needed
Comment 9•10 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla36
You need to log in
before you can comment on or make changes to this bug.
Description
•