I tried to fetch meta data from document and get the data in the false encoding:
var fetchPageMetaData = function () {
var result = [];
var metaDataList = document ? document.querySelectorAll('head meta') : [];
for (var i = 0; i < metaDataList.length; i++) {
var meta = metaDataList[i];
var object = {};
if (meta && meta.attributes) {
for (var j = 0; j < meta.attributes.length; j++) {
var attr = meta.attributes[j].nodeName;
object[attr] = meta.attributes[j].nodeValue;
}
result.push(object);
}
}
return result;
}
Testing the code with Mocha and getting this result for thie page: page with meta data Result:
[{
"content": "text/html; charset=iso-8859-1",
"http-equiv": "Content-Type"
},
{
"content": "www.cm4all.com",
"name": "GENERATOR"
},
{
"content": "Tennis, Fussball, Hobbies",
"name": "keywords"
},
{
"content": "Meine tolle Seite �ber Fussball und Tennis",
"name": "description"
},
{
"content": "Meine tolle Seite �ber Fussball und Tennis",
"name": "abstract"
}]
Expecting result with ü instead of �.