Inspectopedia Help

File contains non-ASCII character

Reports cases in Python 2 when a file contains non-ASCII characters and does not have an encoding declaration at the top.

Example:

class A(object): # №5 def __init__(self): pass

In this example, the IDE reports a non-ASCII symbol in a comment and a lack of encoding declaration. Apply the proposed quick-fix to add a missing encoding declaration:

# coding=utf-8 class A(object) # №5 def __init__(self): pass

Inspection options

Option

Type

Default

Select default encoding

Dropdown

utf-8

Encoding comment format

Dropdown

# coding=[encoding name]

Inspection Details

Available in:

DataSpell 2023.3, PyCharm 2023.3

Plugin:

Python Community Edition, 233.SNAPSHOT

Last modified: 13 July 2023