summaryrefslogtreecommitdiff
path: root/Build/source/texk/web2c/lib/texmfmp.c
diff options
context:
space:
mode:
Diffstat (limited to 'Build/source/texk/web2c/lib/texmfmp.c')
-rw-r--r--Build/source/texk/web2c/lib/texmfmp.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/Build/source/texk/web2c/lib/texmfmp.c b/Build/source/texk/web2c/lib/texmfmp.c
index 9f2f8807433..f3682cfbb6d 100644
--- a/Build/source/texk/web2c/lib/texmfmp.c
+++ b/Build/source/texk/web2c/lib/texmfmp.c
@@ -2086,7 +2086,7 @@ input_line (FILE *f)
if (f != Poptr && fileno (f) != fileno (stdin)) {
long position = ftell (f);
- if (position == 0L) {
+ if (position == 0L) { /* Detect and skip Byte order marks. */
int k1 = getc (f);
if (k1 == EOF || k1 == '\r' || k1 == '\n')
@@ -2096,11 +2096,15 @@ input_line (FILE *f)
if (k2 == EOF || k2 == '\r' || k2 == '\n')
fseek (f, -2L , SEEK_CUR);
- else if (!(k1 == 0xff && k2 == 0xfe) &&
- !(k1 == 0xfe && k2 == 0xff)) {
+ else if ((k1 == 0xff && k2 == 0xfe) || /* UTF-16(LE) */
+ (k1 == 0xfe && k2 == 0xff)) /* UTF-16(BE) */
+ ;
+ else {
int k3 = getc (f);
- if (!(k1 == 0xef && k2 == 0xbb && k3 == 0xbf))
+ if (k1 == 0xef && k2 == 0xbb && k3 == 0xbf) /* UTF-8 */
+ ;
+ else
fseek (f, -3L, SEEK_CUR);
}
}