summaryrefslogtreecommitdiff
path: root/Build
diff options
context:
space:
mode:
authorAkira Kakuto <kakuto@fuk.kindai.ac.jp>2013-06-29 13:55:27 +0000
committerAkira Kakuto <kakuto@fuk.kindai.ac.jp>2013-06-29 13:55:27 +0000
commit0e45eaa243e0008ecc5a2e48d746d793a7cda314 (patch)
tree675036e9ae8841c7c39888ae803df1ba815ff394 /Build
parent162739fb0e841def28075fc136c7337bd4b992eb (diff)
Right console output on windows in ptex and uptex (from T. Tanaka).
git-svn-id: svn://tug.org/texlive/trunk@31036 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build')
-rw-r--r--Build/source/texk/ptexenc/ChangeLog5
-rw-r--r--Build/source/texk/ptexenc/ptexenc.c17
2 files changed, 18 insertions, 4 deletions
diff --git a/Build/source/texk/ptexenc/ChangeLog b/Build/source/texk/ptexenc/ChangeLog
index 86e6d5f6c80..41550559b74 100644
--- a/Build/source/texk/ptexenc/ChangeLog
+++ b/Build/source/texk/ptexenc/ChangeLog
@@ -1,3 +1,8 @@
+2013-06-29 Akira Kakuto <kakuto@fuk.kindai.ac.jp>
+
+ * ptexenc.c: Provide right console output on windows for both
+ ptex and uptex if --sjis-terminal option is given. (from T. Tanaka).
+
2013-06-25 Akira Kakuto <kakuto@fuk.kindai.ac.jp>
* ptexenc.c: Remove redundant lines in input_line2(), which are
diff --git a/Build/source/texk/ptexenc/ptexenc.c b/Build/source/texk/ptexenc/ptexenc.c
index b492876c081..fa680201542 100644
--- a/Build/source/texk/ptexenc/ptexenc.c
+++ b/Build/source/texk/ptexenc/ptexenc.c
@@ -424,6 +424,7 @@ static int put_multibyte(long c, FILE *fp) {
if ((fd == fileno(stdout) || fd == fileno(stderr)) && _isatty(fd)) {
HANDLE hStdout;
DWORD ret, wclen;
+ UINT cp;
wchar_t buff[2];
char str[4];
int mblen;
@@ -440,8 +441,13 @@ static int put_multibyte(long c, FILE *fp) {
/* always */ str[mblen++]=BYTE4(c);
#define CP_932 932
+#define CP_UTF8 65001
- if (MultiByteToWideChar(CP_932, 0, str, mblen, buff, 2) == 0)
+ if (is_internalUPTEX())
+ cp = CP_UTF8;
+ else
+ cp = CP_932;
+ if (MultiByteToWideChar(cp, 0, str, mblen, buff, 2) == 0)
return EOF;
wclen = mblen > 3 ? 2 : 1;
@@ -484,9 +490,12 @@ int putc2(int c, FILE *fp)
#ifdef WIN32
if ((fp == stdout || fp == stderr) && (_isatty(fd) || !prior_file_enc)) {
- if (sjisterminal)
- output_enc = ENC_SJIS;
- else
+ if (sjisterminal) {
+ if (is_internalUPTEX())
+ output_enc = ENC_UTF8;
+ else
+ output_enc = ENC_SJIS;
+ } else
#else
if ((fp == stdout || fp == stderr) && !prior_file_enc) {
#endif