Commit bacba96
committed
diff: add utf-{16,32} binary detection
When we examine a diff_filespec for binary-ness, we can now
also determine whether it's utf-16 or utf-32 by looking for
a BOM. Those encodings are still considered binary, but
future patches will add callers which handle them specially.
Note that even though we know the endian-ness of the
encoding from the BOM, we do not include it in the returned
name. This is because "iconv" (which we'll ultimately feed
these names to) does not expect to see a BOM if we tell it
the source is "UTF-16LE". We should feed it "UTF-16" with
the BOM, which it will interpret itself.
Signed-off-by: Jeff King <peff@peff.net>1 parent 2d56119 commit bacba96
2 files changed
Lines changed: 25 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3685 | 3685 | | |
3686 | 3686 | | |
3687 | 3687 | | |
| 3688 | + | |
| 3689 | + | |
| 3690 | + | |
| 3691 | + | |
| 3692 | + | |
| 3693 | + | |
| 3694 | + | |
| 3695 | + | |
| 3696 | + | |
| 3697 | + | |
| 3698 | + | |
| 3699 | + | |
| 3700 | + | |
| 3701 | + | |
| 3702 | + | |
| 3703 | + | |
| 3704 | + | |
| 3705 | + | |
| 3706 | + | |
| 3707 | + | |
| 3708 | + | |
3688 | 3709 | | |
3689 | 3710 | | |
3690 | 3711 | | |
| |||
3702 | 3723 | | |
3703 | 3724 | | |
3704 | 3725 | | |
| 3726 | + | |
| 3727 | + | |
3705 | 3728 | | |
3706 | 3729 | | |
3707 | 3730 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
76 | | - | |
| 76 | + | |
| 77 | + | |
77 | 78 | | |
78 | 79 | | |
79 | 80 | | |
| |||
0 commit comments