atom/encoding-selector

Uncaught Error: "toString()" failed

50Wliu opened this issue · 1 comments

From @davibicudo on July 31, 2017 11:51

[Enter steps to reproduce:]

  1. Open a large file
  2. Try to change encoding to AutoDetect option
    Perhaps it has something to do with issue #7210 ?

Atom: 1.19.0-beta5 x64
Electron: 1.6.9
OS: Mac OS X 10.12.5
Thrown From: Atom Core

Stack Trace

Uncaught Error: "toString()" failed

At buffer.js:503

Error: "toString()" failed
    at Buffer.toString (buffer.js:503:11)
    at Object.jschardet.detect (/Applications/Atom Beta.app/Contents/Resources/app/node_modules/jschardet/src/init.js:72:29)
    at /Applications/Atom Beta.app/Contents/Resources/app/node_modules/encoding-selector/lib/encoding-list-view.js:143:53
    at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:416:3)

Commands

     -1:40.3.0 core:paste (input.input-text.native-key-bindings)
 13x -0:51.1.0 core:backspace (input.hidden-input)
     -0:38.9.0 grammar-selector:show (atom-text-editor.editor)
     -0:33 editor:consolidate-selections (input.hidden-input)
     -0:33 core:cancel (input.hidden-input)
     -0:30.4.0 encoding-selector:show (atom-text-editor.editor)
     -0:28.5.0 editor:consolidate-selections (input.hidden-input)
     -0:28.5.0 core:cancel (input.hidden-input)
  3x -0:27.7.0 encoding-selector:show (atom-text-editor.editor)

Non-Core Packages

autocomplete-solidity 0.3.3 
etheratom 3.1.0 
linter-solidity 0.5.0 

Copied from original issue: atom/atom#15134

JSChardet uses buffer.toString() internally. fs.readFile() passes the entire contents of the file to JSChardet.