-
Notifications
You must be signed in to change notification settings - Fork 605
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Stripping BOM if at the beginning of file
Closes #99
- Loading branch information
1 parent
36f2c5b
commit 6e83733
Showing
5 changed files
with
40 additions
and
3 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
xml2js = require '../lib/xml2js' | ||
|
||
exports.stripBOM = (str) -> | ||
if str[0] == '\uFEFF' | ||
str.substring(1) | ||
else | ||
str | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
xml2js = require '../lib/xml2js' | ||
assert = require 'assert' | ||
equ = assert.equal | ||
|
||
module.exports = | ||
'test decoded BOM': (test) -> | ||
demo = '\uFEFF<xml><foo>bar</foo></xml>' | ||
xml2js.parseString demo, (err, res) -> | ||
equ err, undefined | ||
equ res.xml.foo[0], 'bar' | ||
test.done() |