diff options
| author | Mats Wichmann <mats@linux.com> | 2024-02-07 19:31:31 (GMT) |
|---|---|---|
| committer | Mats Wichmann <mats@linux.com> | 2024-02-08 16:28:29 (GMT) |
| commit | 180c601ade468d9b0ac7e535b956816381849c6a (patch) | |
| tree | 91215b5f2770bcb33762f96f17eff24ffd754555 /test/Java/java_version_image/src1/Example7.java | |
| parent | 7e120e84307ea7a81ef93ca1a98d50f1e2349d36 (diff) | |
| download | SCons-180c601ade468d9b0ac7e535b956816381849c6a.zip SCons-180c601ade468d9b0ac7e535b956816381849c6a.tar.gz SCons-180c601ade468d9b0ac7e535b956816381849c6a.tar.bz2 | |
Be more careful about file reading
If SCons reads a file to interpret the contents, codecs are a concern.
The File node class has a get_text_contents() method which makes a best
effort at decoding bytes data, but there are other places that don't get
their file contents via that method, and so should do their own careful
decoding - but don't, they just read as text and hope it's okay.
Move the decode-bytes portion out of File.get_text_contents() to
SCons.Util.to_Text() so that everyone that needs this can call it.
Add a couple of additional known BOM codes (after consulting Python's
codecs module).
Note that while get_text_contents acts on nodes, the new (moved) routine
to_Text acts on passed bytes, so it can be used in a non-Node context
as well - for example the Java tool initializer reads a file and tries
to decode it, and can get it wrong (see #3569), this change provides it
some help.
Fixes #3569
FIxes #4462
Signed-off-by: Mats Wichmann <mats@linux.com>
Diffstat (limited to 'test/Java/java_version_image/src1/Example7.java')
0 files changed, 0 insertions, 0 deletions
