From 043adcf0f600daaecbce447cb6289aca193b6151 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Tue, 27 Jan 2009 00:03:34 -0600 Subject: [PATCH] Use windows-1252 encoding for stdin/stdout on Windows --- basis/io/backend/windows/windows.factor | 6 ++++-- core/io/backend/backend.factor | 12 ++++++++---- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/basis/io/backend/windows/windows.factor b/basis/io/backend/windows/windows.factor index e7c72edfd0..bf01f1d621 100755 --- a/basis/io/backend/windows/windows.factor +++ b/basis/io/backend/windows/windows.factor @@ -1,7 +1,7 @@ ! Copyright (C) 2004, 2008 Mackenzie Straight, Doug Coleman. ! See http://factorcode.org/license.txt for BSD license. -USING: alien alien.c-types arrays destructors io io.backend -io.buffers io.files io.ports io.binary io.timeouts +USING: alien alien.c-types arrays destructors io io.backend io.buffers +io.files io.ports io.binary io.timeouts io.encodings.8-bit windows.errors strings kernel math namespaces sequences windows windows.kernel32 windows.shell32 windows.types windows.winsock splitting continuations math.bitwise system accessors ; @@ -52,3 +52,5 @@ HOOK: add-completion io-backend ( port -- ) "SECURITY_ATTRIBUTES" "SECURITY_ATTRIBUTES" heap-size over set-SECURITY_ATTRIBUTES-nLength ; + +M: windows console-encoding windows-1252 ; \ No newline at end of file diff --git a/core/io/backend/backend.factor b/core/io/backend/backend.factor index e2c6c3d464..dc22c7a975 100644 --- a/core/io/backend/backend.factor +++ b/core/io/backend/backend.factor @@ -1,4 +1,4 @@ -! Copyright (C) 2007, 2008 Slava Pestov. +! Copyright (C) 2007, 2009 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. USING: init kernel system namespaces io io.encodings io.encodings.utf8 init assocs splitting alien ; @@ -14,11 +14,15 @@ HOOK: init-io io-backend ( -- ) HOOK: (init-stdio) io-backend ( -- stdin stdout stderr ) +HOOK: console-encoding os ( -- encoding ) + +M: object console-encoding utf8 ; + : init-stdio ( -- ) (init-stdio) - [ utf8 input-stream set-global ] - [ utf8 output-stream set-global ] - [ utf8 error-stream set-global ] tri* ; + [ console-encoding input-stream set-global ] + [ console-encoding output-stream set-global ] + [ console-encoding error-stream set-global ] tri* ; HOOK: io-multiplex io-backend ( us -- ) -- 2.11.4.GIT