sindresorhus / atom-editorconfig

Helps developers maintain consistent coding styles between different editors
https://atom.io/packages/editorconfig
MIT License
812 stars 80 forks source link

Uncaught Error: Encoding not recognized: 'utf8bom' (searched as: 'utf8bom') #206

Closed JourneyOver closed 6 years ago

JourneyOver commented 6 years ago

[Enter steps to reproduce:]

  1. save file as utf8bom in another editor or have [*.ps1] charset = utf-8-bom in .editorconfig file and save on atom
  2. try to open or save file in Atom throws errors ( and doesn't save)

Atom: 1.21.0-beta2 x64 Electron: 1.6.9 OS: Microsoft Windows 10 Pro Thrown From: editorconfig package 2.2.2

Stack Trace

Uncaught Error: Encoding not recognized: 'utf8bom' (searched as: 'utf8bom')

At C:\Users\JourneyOver\AppData\Local\atom\app-1.21.0-beta2\resources\app.asar\node_modules\iconv-lite\lib\index.js:106

Error: Encoding not recognized: 'utf8bom' (searched as: 'utf8bom')
    at Object.getCodec (/app.asar/node_modules/iconv-lite/lib/index.js:106:23)
    at File.module.exports.File.setEncoding (~/AppData/Local/atom/app-1.21.0-beta2/resources/app/node_modules/pathwatcher/lib/file.js:189:21)
    at TextBuffer.module.exports.TextBuffer.setEncoding (~/AppData/Local/atom/app-1.21.0-beta2/resources/app/node_modules/text-buffer/lib/text-buffer.js:502:22)
    at Object.applySettings (/packages/editorconfig/index.js:76:14)
    at observeActivePaneItem (/packages/editorconfig/index.js:244:36)
    at Function.module.exports.Emitter.simpleDispatch (~/AppData/Local/atom/app-1.21.0-beta2/resources/app/node_modules/event-kit/lib/emitter.js:25:20)
    at Emitter.module.exports.Emitter.emit (~/AppData/Local/atom/app-1.21.0-beta2/resources/app/node_modules/event-kit/lib/emitter.js:141:34)
    at Workspace.didChangeActivePaneItemOnPaneContainer (~/AppData/Local/atom/app-1.21.0-beta2/resources/app/src/workspace.js:492:28)
    at WorkspaceCenter.paneContainer.onDidChangeActivePaneItem (~/AppData/Local/atom/app-1.21.0-beta2/resources/app/src/workspace-center.js:17:20)
    at Function.module.exports.Emitter.simpleDispatch (~/AppData/Local/atom/app-1.21.0-beta2/resources/app/node_modules/event-kit/lib/emitter.js:25:20)
    at Emitter.module.exports.Emitter.emit (~/AppData/Local/atom/app-1.21.0-beta2/resources/app/node_modules/event-kit/lib/emitter.js:141:34)
    at PaneContainer.didChangeActiveItemOnPane (~/AppData/Local/atom/app-1.21.0-beta2/resources/app/src/pane-container.js:284:26)
    at PaneContainer.didActivatePane (~/AppData/Local/atom/app-1.21.0-beta2/resources/app/src/pane-container.js:262:18)
    at Pane.module.exports.Pane.activate (~/AppData/Local/atom/app-1.21.0-beta2/resources/app/src/pane.js:925:20)
    at Pane.module.exports.Pane.focus (~/AppData/Local/atom/app-1.21.0-beta2/resources/app/src/pane.js:290:25)
    at /app.asar/src/pane-element.js:51:25)

Commands

 17x -4:37.8.0 core:move-left (input.hidden-input)
     -4:36 core:backspace (input.hidden-input)
     -4:31.6.0 editor:consolidate-selections (input.hidden-input)
     -4:31.6.0 core:cancel (input.hidden-input)
     -4:30 editor:consolidate-selections (input.hidden-input)
     -4:30 core:cancel (input.hidden-input)
  5x -1:34.9.0 intentions:highlight (input.hidden-input)
     -1:34.3.0 core:save (input.hidden-input)
     -1:32 intentions:highlight (input.hidden-input)
     -1:31.6.0 core:save (input.hidden-input)
     -1:10.9.0 window:toggle-dev-tools (ul.list-inline.tab-bar.inset-panel)
     -1:03.1.0 intentions:highlight (input.hidden-input)
     -1:02.7.0 core:save (input.hidden-input)
     -0:39.4.0 encoding-selector:show (atom-text-editor.editor)
     -0:33.3.0 intentions:highlight (input.hidden-input)
     -0:33 core:save (input.hidden-input)

Non-Core Packages

atom-beautify 0.30.5 
busy-signal 1.4.3 
editorconfig 2.2.2 
file-icons 2.1.12 
intentions 1.1.5 
language-AHK 0.0.2 
language-batch 0.4.0 
language-markdown 0.25.1 
language-powershell 4.0.0 
linter 2.2.0 
linter-csslint 2.0.0 
linter-jshint 3.1.6 
linter-markdown 5.2.0 
linter-ui-default 1.6.10 
platformio-ide-terminal 2.7.0 
seti-syntax 1.1.3 
seti-ui 1.9.0 
split-diff 1.5.1 
sindresorhus commented 6 years ago

The utf-8-bom property is intentionally not supported as it's a bad practice: https://stackoverflow.com/questions/2223882/whats-different-between-utf-8-and-utf-8-without-bom/2223926#2223926

We should make that clear in the readme.

florianb commented 6 years ago

@JourneyOver - thank you very much for that finding. Besides of Sindres argument, Atom doesn't support utf-8 boms in any way: https://github.com/atom/encoding-selector/issues/18

I will point that out in the readme.

I am closing this issue - but please feel free to come back if you have any further feedback or questions.

florianb commented 6 years ago

No worries @JourneyOver - i completely understand your disappointment, as well as the disappointment of others. Besides of my opinion about BOMs in general, this is clearly something the Atom-Core must take care of.

I am really sorry i can't help you out.