Skip to content

Instantly share code, notes, and snippets.

@arikon
Created October 7, 2010 19:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arikon/615685 to your computer and use it in GitHub Desktop.
Save arikon/615685 to your computer and use it in GitHub Desktop.
<?xml version="1.0" encoding="windows-1251"?>
<root>
<!-- Save this file with windows-1251 encoding! -->
<hello>Привет, товарищ!</hello>
</root>
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