Opened 5 years ago

Closed 5 years ago

#2296 closed change (rejected)

Get rid of codecs.open()

Reported by: sebastian Assignee: sebastian
Priority: P4 Milestone:
Module: Sitescripts Keywords:
Cc: Blocked By:
Blocking: Platform: Unknown
Ready: yes Confidential: no
Tester: Verified working: no
Review URL(s):

Description (last modified by sebastian)

Background

codecs.open() has been superseded by io.open(). Beside beeing newer, io.open() if used in text mode, also enforces the written data to be unicode objects, preventing accidental encoding issues.

Moreover, some code currently uses codecs.open() while binary data actually sent or expected. That code will currently result in encoding errors when encountering non-ASCII characters.

What to change

Replace codecs.open() with io.open() when processing decoded text, and otherwise with open().

Change History (2)

comment:1 Changed 5 years ago by sebastian

  • Review URL(s) modified (diff)
  • Status changed from new to reviewing

comment:2 Changed 5 years ago by sebastian

  • Description modified (diff)
  • Resolution set to rejected
  • Review URL(s) modified (diff)
  • Status changed from reviewing to closed

My assumptions here weren't quite right. Though using io.open() instead makes sense for new code, but this isn't worth changing the existing code. The prospect of breaking something and the afford properly testing the change would be too large.

Note: See TracTickets for help on using tickets.