#4471: Incorrect Unicode output on Windows Console
------------------------+---------------------------------------------------
    Reporter:  sankeld  |       Owner:                             
        Type:  bug      |      Status:  new                        
    Priority:  normal   |   Component:  Compiler                   
     Version:  6.12.3   |    Keywords:                             
    Testcase:           |   Blockedby:                             
          Os:  Windows  |    Blocking:                             
Architecture:  x86      |     Failure:  Incorrect result at runtime
------------------------+---------------------------------------------------

Comment(by sankeld):

 A solution that doesn't require changing from the posix emulation layer is
 shown [here
 http://blogs.msdn.com/b/michkap/archive/2008/03/18/8306597.aspx]

 test.c
 {{{
 #include <fcntl.h>
 #include <io.h>
 #include <stdio.h>
 #include <unistd.h>

 int main()
 {
     //this seems to fix the problem
     _setmode(_fileno(stdout), _O_U8TEXT );
     char testStr[] = "∷⇒∀→←⋯⊢";
     //posix emulation
     write( STDOUT_FILENO, testStr, strlen(testStr) );
     return 0;
 }
 }}}

 `gcc test.c -o test.exe`
 `test.exe`
 {{{
 ∷⇒∀→←⋯⊢
 }}}
 `test.exe > output && type output`
 {{{
 ∷⇒∀→←⋯⊢
 }}}

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/4471#comment:3>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to