BoBK
BoBK

Reputation: 31

Using special character ^ or ¨ in python 3 idle crashes the program

When I use these specials characters ^ or ¨ in python IDLE version 3, it makes the program crash.

I'm French and so I use these specials characters in my description or comments in my code. Is there a way to use it without crashing the program?

Thanks !

Upvotes: 3

Views: 1619

Answers (1)

AJMansfield
AJMansfield

Reputation: 4175

Many language specifications, and most compilers, specifically recommend against using special characters because of problems like this.

However, from http://docs.python.org/2/reference/lexical_analysis.html

New in version 2.3: An encoding declaration can be used to indicate that string literals and comments use an encoding different from ASCII.

So include that declaration, and it should work.

If you already have such a declaration, the problem may then be not because of the characters themselves, but because of the way your setup combines the ^ and ¨ accents with other characters. Although at that point, I'm really just shooting in the dark.

Upvotes: 1

Related Questions