3
suffixes = {
    1: ["ो", "े", "ू", "ु", "ी", "ि", "ा"]}

When I done message given by IDLE is

Unsupported characters in input

Also not see the proper font in MS-DOS.

3 Answers 3

4

What encoding is your source file in?

If it is UTF8, put the comment

# -*- coding: utf-8 -*-

at the top of the file.

Sign up to request clarification or add additional context in comments.

2 Comments

Alternatively you can use ['\xe0\xa5\x8b', '\xe0\xa5\x87', '\xe0\xa5\x82', '\xe0\xa5\x81', '\xe0\xa5\x80', '\xe0\xa4\xbf', '\xe0\xa4\xbe'] if you do not want to locally set the encoding but that does not guarantee you that your DOS console will be able to print that output correctly.
What's the solution for using IDLE interactively: just opening IDLE and trying to input the string?
0

If you don't declare encoding in your first or second line in your python source file, then the python interpreter will use ASCII encoding system to decode the characters in the file. As these characters you used couldn't be decoded by ASCII encoding system, errors happended.

The solution is as @RemcoGerlich said. Here is the doc.

The encoding is used for all lexical analysis, in particular to find the end of a string, and to interpret the contents of Unicode literals. String literals are converted to Unicode for syntactical analysis, then converted back to their original encoding before interpretation starts. The encoding declaration must appear on a line of its own.

Comments

0

This seems to be a known bug in the 2.x IDLE console: http://bugs.python.org/issue15809. A fix was made for Python 3.x, but doesn't appear to be backported.

Instead, use an alternative console, such as iPython/Jupyter, or a fully-fledged IDE, such as PyCharm.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.