Cut to file character encoding issue creates empty file

Open
#146 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
42/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
python
Domain
tooling

Research direction

Start with advanced_new_file.commands.cut_to_file, especially entered_file_action and _open_and_add_content_to_file, which appear in the traceback. Reproduce the issue with a UTF-8 CSV containing the reported character, then verify that Cut to file completes without the UnicodeEncodeError and preserves the file content.

Written by the indexing model from the issue text.

Description

I have UTF8 .csv file and Cut to file doesn't work.

From the console:

Traceback (most recent call last):
  File "advanced_new_file.commands.command_base in \Data\Installed Packages\AdvancedNewFile.sublime-package", line 315, in on_done
  File "advanced_new_file.commands.command_base in \Data\Installed Packages\AdvancedNewFile.sublime-package", line 344, in entered_filename
  File "advanced_new_file.commands.cut_to_file in \Data\Installed Packages\AdvancedNewFile.sublime-package", line 47, in entered_file_action
  File "advanced_new_file.commands.cut_to_file in \Data\Installed Packages\AdvancedNewFile.sublime-package", line 71, in _open_and_add_content_to_file
  File "./encodings/cp1252.py", line 19, in encode
UnicodeEncodeError: 'charmap' codec can't encode character '\u021b' in position 20: character maps to <undefined>

Thanks!

Dominant language
Python
Stars
832
Forks
96
Avg merge
1m
Merged PRs (30d)
5

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from SublimeText/AdvancedNewFile

All issues in SublimeText/AdvancedNewFile

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.