summaryrefslogtreecommitdiff
path: root/Build/source/texk/ptexenc/ptexenc.c
diff options
context:
space:
mode:
Diffstat (limited to 'Build/source/texk/ptexenc/ptexenc.c')
-rw-r--r--Build/source/texk/ptexenc/ptexenc.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/Build/source/texk/ptexenc/ptexenc.c b/Build/source/texk/ptexenc/ptexenc.c
index d12f3459b56..59a17cdea4d 100644
--- a/Build/source/texk/ptexenc/ptexenc.c
+++ b/Build/source/texk/ptexenc/ptexenc.c
@@ -25,6 +25,7 @@
static int default_kanji_enc = ENC_UTF8;
static boolean UPTEX_enabled;
+static boolean prior_file_enc = false;
#define ESC '\033'
@@ -157,6 +158,11 @@ void enable_UPTEX (boolean enable)
}
}
+void set_prior_file_enc(void)
+{
+ prior_file_enc = true;
+}
+
const_string get_enc_string(void)
{
static char buffer[20]; /* enough large space */
@@ -437,7 +443,8 @@ int putc2(int c, FILE *fp)
const int fd = fileno(fp);
int ret = c, output_enc;
- if (fp == stdout || fp == stderr) output_enc = get_terminal_enc();
+ if ((fp == stdout || fp == stderr) && !(prior_file_enc))
+ output_enc = get_terminal_enc();
else output_enc = get_file_enc();
if (num[fd] > 0) { /* multi-byte char */