Always use byte strings and don't inherit encodings for diff content.

Review Request #11717 — Created July 20, 2021 and submitted

Information

DiffX
master

Reviewers

Diff sections are no longer decoded to Unicode strings if an encoding is
specified. Instead, they're always represented as byte strings. This is
more consistent for consumers to work with, and gives them the choice
as to whether they want to use the byte string as-is (such as when
writing to disk or a stream) or whether they want to decode it
themselves.

On the writing end, encodings were still being inherited, which could
end up causing the wrong encoding to be set. Now, diff sections are set
to not inherit the encodings of a parent section.

Unit tests pass.

Summary ID
Always use byte strings and don't inherit encodings for diff content.
Diff sections are no longer decoded to Unicode strings if an encoding is specified. Instead, they're always represented as byte strings. This is more consistent for consumers to work with, and gives them the choice as to whether they want to use the byte string as-is (such as when writing to disk or a stream) or whether they want to decode it themselves. On the writing end, encodings were still being inherited, which could end up causing the wrong encoding to be set. Now, diff sections are set to not inherit the encodings of a parent section.
37af9d7004b2cf2320ad35e7dd8803779f1ded22
Description From Last Updated

This is long enough that we should switch to one per line.

daviddavid

This should be one arg per line.

daviddavid
david
  1. 
      
  2. python/pydiffx/reader.py (Diff revision 1)
     
     
     
     
    Show all issues

    This is long enough that we should switch to one per line.

  3. python/pydiffx/writer.py (Diff revision 1)
     
     
     
     
     
     
    Show all issues

    This should be one arg per line.

  4. 
      
chipx86
Review request changed
Status:
Completed
Change Summary:
Pushed to master (bc69db2)