Hi, I got two question. :)

First there is this annoying problem with running my script from IDLE that for the character é (the ' and e) I got after using ord() the value 233. When I run the script from cmd.exe I get the value 130.

Why the difference and how do I fix this?

The other thing is that when you print something with my script you get this python.exe cmd look-a-like thing. It does not have any text paste options, how can I add these?

I'm using python 2.6. I haven't tried other version... yet.

I assume you are talking about the Python shell that comes up with IDLE as an output window.

You have to tell Python which type of encoding to use, try this ...

# -*- coding: cp1252 -*-

print chr(233)  # é 
print chr(130)  # ‚

I solved the second question, just make a small .exe file with system() written in C(++) that opens the .py file and you get copy/paste options instead of python.exe that doesn't have that.

Does anybody know how to solve the chr() problem? (that in normal IDLE for example 235 is ë and in 'dos'/'command' it is ù.

I'm afraid I'm gonna need to rename all the files again... (font in images)...

This is the problem:

So what is your code?

When you have a letter like 'K', you can with the command ord('K') receive the value 75. If you run this in IDLE it is 75, if you run this in python.exe (or cmd.exe) it is also 75. BUT!, if the letter is a special one, like 'é', you get 233 in IDLE and 130 in python.exe (or cmd.exe). So all the special letters are a different number (like random different).

Now I would like to have the IDLE 'numbering' (which is correct: http://msdn.microsoft.com/nl-nl/goglobal/cc305145%28en-us%29.aspx) in python.exe or cmd.exe. How do I do that?

My code works on ord() and chr() (opposite of ord). I think my code is good, but the encoding somewhere is wrong and I need to set it correct in cmd.exe or python code.

This should tell DOS what kind of decoding you want to use:

# -*- coding: latin-1 -*-

print ord('é'.decode("latin-1"))     # 233

This should tell DOS what kind of decoding you want to use:

# -*- coding: latin-1 -*-

print ord('é'.decode("latin-1"))     # 233

Thank you very much. That fixed it! :D

Thank you very much. That fixed it! :D

sht, in python.exe dos it works, but when I call my script with an .exe it does not work. setting dos to chcp 1252 does work, but gives weird signs in dos self... this stuff is hell...

To handle all the world's thousands of characters is the task of unicode. There is a rub, your computer has to have a particular character in its character set and you have to tell it which language code you want to use.

When you compile your C++ program, you have to compile it with unicode specifications to get the proper character set. If you write programs for the international market unicode is important and can get hairy. Most programming editors allow you to set the encoding as an option.

IMHO, Python3 handles the whole unicode thing a lot better.