Skip to content

Dataloss when Unicode character cannot be mapped (with --overwrite-in-place and --lai) #2391

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
InstanceGaming opened this issue Mar 29, 2025 · 0 comments

Comments

@InstanceGaming
Copy link

Version: 6.0.1
Interpreter: Python 3.11.2
OS: Windows 10 22H2 Build 19045.4894

Steps to reproduce

  1. Create a source file with exactly this content, for example orange.py:
import os

print('∅')
  1. Run isort --overwrite-in-place --lai 2 orange.py.
  2. Results in the file being emptied and the warning: ...isort\main.py:1214: UserWarning: Unable to parse file .\orange.py due to 'charmap' codec can't encode character '\u2205' in position 22: character maps to <undefined> sort_imports( # type: ignore.

What I expected

While I understand what the warning is about, I expect isort to not silently delete source code because of a simple encoding error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant