[Python-Dev] Python dies upon printing UNICODE using UTF-8

Duncan Booth duncan@rcp.co.uk
Wed, 16 Apr 2003 15:22:06 +0100

sismex01@hebmex.com wrote in 

> the interpreter simply exits without any message, exception,
> peep, anything; it simply quits without printing anything.
> Any suggestions?

I think its a problem with windows, or with the C runtime rather than 
Python. The line editing is handled by the system and is obviously screwy. 
Python is interpreting what you entered as signalling end of file. Call 
raw_input and type your text there and you will get an EOFError.

Try typing any non-ascii character at Python's prompt (e.g. euro symbol) 
while the selected codepage is 65001, now move the cursor back to anywhere 
earlier in the input line and enter some more text. The non-ascii character 
character displayed will change.
If you restart the interpreter and recall the line you entered you won't 
get the characters you thought you typed.

Now write a C program:
#include <stdio.h>
int main()
   char s[256];
   return 0;

Compile and run it and you get exactly the same behaviour.

Duncan Booth                                             duncan@rcp.co.uk
int month(char *p){return(124864/((p[0]+p[1]-p[2]&0x1f)+1)%12)["\5\x8\3"
"\6\7\xb\1\x9\xa\2\0\4"];} // Who said my code was obscure?