Use windows-1252 encoding for stdin/stdout on Windows

db4
Slava Pestov 2009-01-27 00:03:34 -06:00
parent 1dca238581
commit 043adcf0f6
2 changed files with 12 additions and 6 deletions

View File

@ -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" <c-object>
"SECURITY_ATTRIBUTES" heap-size
over set-SECURITY_ATTRIBUTES-nLength ;
M: windows console-encoding windows-1252 ;

View File

@ -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 <decoder> input-stream set-global ]
[ utf8 <encoder> output-stream set-global ]
[ utf8 <encoder> error-stream set-global ] tri* ;
[ console-encoding <decoder> input-stream set-global ]
[ console-encoding <encoder> output-stream set-global ]
[ console-encoding <encoder> error-stream set-global ] tri* ;
HOOK: io-multiplex io-backend ( us -- )