Created
October 7, 2010 19:03
-
-
Save arikon/615685 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
<?xml version="1.0" encoding="windows-1251"?> | |
<root> | |
<!-- Save this file with windows-1251 encoding! --> | |
<hello>Привет, товарищ!</hello> | |
</root> |
This file contains hidden or 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
var libxml = require('libxmljs'), doc; | |
try { | |
doc = libxml.parseXmlFile('input.xml'); | |
} catch (e) { | |
// output is: | |
// Input is not proper UTF-8, indicate encoding ! | |
// Bytes: 0xCF 0xF0 0xE8 0xE2 | |
console.log(e.message); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment