aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--win32/winansi.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/win32/winansi.c b/win32/winansi.c
index 84652b5f2..45bb8806c 100644
--- a/win32/winansi.c
+++ b/win32/winansi.c
@@ -725,6 +725,9 @@ static BOOL winansi_CharToOemBuff(LPCSTR s, LPSTR d, DWORD len)
725 WCHAR *buf; 725 WCHAR *buf;
726 int i; 726 int i;
727 727
728 if (GetConsoleOutputCP() != 858)
729 return CharToOemBuff(s, d, len);
730
728 if (!s || !d) 731 if (!s || !d)
729 return FALSE; 732 return FALSE;
730 733
@@ -732,11 +735,9 @@ static BOOL winansi_CharToOemBuff(LPCSTR s, LPSTR d, DWORD len)
732 buf = xmalloc(len*sizeof(WCHAR)); 735 buf = xmalloc(len*sizeof(WCHAR));
733 MultiByteToWideChar(CP_ACP, 0, s, len, buf, len); 736 MultiByteToWideChar(CP_ACP, 0, s, len, buf, len);
734 WideCharToMultiByte(CP_OEMCP, 0, buf, len, d, len, NULL, NULL); 737 WideCharToMultiByte(CP_OEMCP, 0, buf, len, d, len, NULL, NULL);
735 if (GetConsoleOutputCP() == 858) { 738 for (i=0; i<len; ++i) {
736 for (i=0; i<len; ++i) { 739 if (buf[i] == 0x20ac) {
737 if (buf[i] == 0x20ac) { 740 d[i] = 0xd5;
738 d[i] = 0xd5;
739 }
740 } 741 }
741 } 742 }
742 free(buf); 743 free(buf);
@@ -755,6 +756,9 @@ BOOL winansi_OemToCharBuff(LPCSTR s, LPSTR d, DWORD len)
755 WCHAR *buf; 756 WCHAR *buf;
756 int i; 757 int i;
757 758
759 if (GetConsoleCP() != 858)
760 return OemToCharBuff(s, d, len);
761
758 if (!s || !d) 762 if (!s || !d)
759 return FALSE; 763 return FALSE;
760 764
@@ -762,11 +766,9 @@ BOOL winansi_OemToCharBuff(LPCSTR s, LPSTR d, DWORD len)
762 buf = xmalloc(len*sizeof(WCHAR)); 766 buf = xmalloc(len*sizeof(WCHAR));
763 MultiByteToWideChar(CP_OEMCP, 0, s, len, buf, len); 767 MultiByteToWideChar(CP_OEMCP, 0, s, len, buf, len);
764 WideCharToMultiByte(CP_ACP, 0, buf, len, d, len, NULL, NULL); 768 WideCharToMultiByte(CP_ACP, 0, buf, len, d, len, NULL, NULL);
765 if (GetConsoleOutputCP() == 858) { 769 for (i=0; i<len; ++i) {
766 for (i=0; i<len; ++i) { 770 if (buf[i] == 0x0131) {
767 if (buf[i] == 0x0131) { 771 d[i] = 0x80;
768 d[i] = 0x80;
769 }
770 } 772 }
771 } 773 }
772 free(buf); 774 free(buf);