cs150bf / ever-notedown

Atom Editor Plugin
MIT License
140 stars 13 forks source link

Uncaught InvalidCharacterError: Failed to execute 'btoa' on 'Window': The string to be encoded co... #4

Open zhaoshe opened 9 years ago

zhaoshe commented 9 years ago

[Enter steps to reproduce below:]

  1. ...
  2. ...

Atom Version: 1.0.0 System: Mac OS X 10.10.3 Thrown From: ever-notedown package, v0.2.2

Stack Trace

Uncaught InvalidCharacterError: Failed to execute 'btoa' on 'Window': The string to be encoded contains characters outside of the Latin1 range.

At /Users/august/.atom/packages/ever-notedown/lib/svg2png-helper.coffee:108

Error: Failed to execute 'btoa' on 'Window': The string to be encoded contains characters outside of the Latin1 range.
    at Error (native)
    at Object.module.exports.svg2png (/Users/august/.atom/packages/ever-notedown/lib/svg2png-helper.coffee:135:52)
    at /Users/august/.atom/packages/ever-notedown/lib/mathjax-helper.coffee:96:34
    at Function.CALLBACK.execute (file:///Users/august/.atom/packages/ever-notedown/assets/mathjax/MathJax.js?delayStartupUntil=configured:19:3084)
    at cb (file:///Users/august/.atom/packages/ever-notedown/assets/mathjax/MathJax.js?delayStartupUntil=configured:19:2661)
    at BASE.Object.Subclass.Process (file:///Users/august/.atom/packages/ever-notedown/assets/mathjax/MathJax.js?delayStartupUntil=configured:19:8561)
    at BASE.Object.Subclass.call (file:///Users/august/.atom/packages/ever-notedown/assets/mathjax/MathJax.js?delayStartupUntil=configured:19:8818)
    at Function.WAITEXECUTE (file:///Users/august/.atom/packages/ever-notedown/assets/mathjax/MathJax.js?delayStartupUntil=configured:19:6016)
    at cb (file:///Users/august/.atom/packages/ever-notedown/assets/mathjax/MathJax.js?delayStartupUntil=configured:19:2661)
    at BASE.Object.Subclass.Process (file:///Users/august/.atom/packages/ever-notedown/assets/mathjax/MathJax.js?delayStartupUntil=configured:19:8561)

Commands

     -0:18.3.0 application:open (atom-text-editor.editor.is-focused)
     -0:08.2.0 tree-view:toggle (atom-text-editor.editor.is-focused)
     -0:02.2.0 ever-notedown:toggle-preview (atom-text-editor.editor.is-focused)

Config

{
  "core": {},
  "ever-notedown": {
    "gitPath": "/Users/august/百度云同步盘/Notes",
    "sortBy": "Notebook"
  }
}

Installed Packages

# User
ever-notedown, v0.2.2

# Dev
No dev packages
cs150bf commented 9 years ago

@zhaoshe I've made a quick fix which probably doesn't work actually, but it should at least stop the error from popping up.

May I ask what kind of mathjax/latex equation are you writing when you see this error? Do you have some special characters in it? From a glance, I think handling mathjax equations containing non-latin1 characters could be a tricky business and I would suggest avoiding those cases for now, as unfortunately at this moment I have very little time to work on figuring it out... But if anybody would like to help, contributions would be appreciated.

If you are not writing math equations...perhaps you have multiple dollar signs "$" in your note? In which case you probably want to escape them with backslash ("\$") or turn off the "mathjax" option in settings, otherwise anything between two dollar signs would be interpreted as a math equation.