neyestrabelli / xml-formatter

Simple XML Formatter for Atom
MIT License
22 stars 7 forks source link

Why does xml encoding have to be UTF-8 only? #14

Closed ghost closed 9 years ago

ghost commented 9 years ago

I have noticed in the repo you have hard coded UTF-8 in a number of place which is explaining the issues I'm getting into when trying to formate UTF-16 xml files.

Is there a reason for not allowing XML payloads with UTF-16 charsets to be indented?

Error Message:

Traceback (most recent call last):
  File "/Applications/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 556, in run_
    return self.run(edit)
  File "indentxml in /Users/mdown/Library/Application Support/Sublime Text 3/Installed Packages/Indent XML.sublime-package", line 49, in run
  File "indentxml in /Users/mdown/Library/Application Support/Sublime Text 3/Installed Packages/Indent XML.sublime-package", line 96, in indent
  File "indentxml in /Users/mdown/Library/Application Support/Sublime Text 3/Installed Packages/Indent XML.sublime-package", line 93, in indent
  File "./xml/dom/minidom.py", line 1970, in parseString
  File "./xml/dom/expatbuilder.py", line 926, in parseString
  File "./xml/dom/expatbuilder.py", line 221, in parseString
xml.parsers.expat.ExpatError: syntax error: line 1, column 0
reloading Packages/User/Package Control.sublime-settings
reloading Packages/User/Preferences.sublime-settings
Traceback (most recent call last):
  File "/Applications/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 556, in run_
    return self.run(edit)
  File "indentxml in /Users/mdown/Library/Application Support/Sublime Text 3/Installed Packages/Indent XML.sublime-package", line 44, in run
  File "indentxml in /Users/mdown/Library/Application Support/Sublime Text 3/Installed Packages/Indent XML.sublime-package", line 96, in indent
  File "indentxml in /Users/mdown/Library/Application Support/Sublime Text 3/Installed Packages/Indent XML.sublime-package", line 93, in indent
  File "./xml/dom/minidom.py", line 1970, in parseString
  File "./xml/dom/expatbuilder.py", line 926, in parseString
  File "./xml/dom/expatbuilder.py", line 221, in parseString
xml.parsers.expat.ExpatError: encoding specified in XML declaration is incorrect: line 1, column 30
neyestrabelli commented 9 years ago

@michaelkdown this plugin was made for Atom and works fine in all encoding. I don't know the difference to the sublime text.