node-gettext
Advanced tools
Comparing version 0.2.8 to 0.2.9
@@ -32,6 +32,6 @@ var Iconv = require("iconv").Iconv; | ||
var str = (this._fileContents || "").toString(), | ||
pos, headers = str, charset = "iso-8859-1"; | ||
pos, headers = str, charset = "iso-8859-1", match; | ||
if((pos = str.search(/^\s*msgid/im))>=0){ | ||
if((pos = str.substr(pos+5).search(/^\s*(msgid|msgctxt)/im))){ | ||
if((pos = pos+str.substr(pos+5).search(/^\s*(msgid|msgctxt)/im))){ | ||
headers = str.substr(0, pos); | ||
@@ -41,4 +41,4 @@ } | ||
if((charset = headers.match(/[; ]charset\s*=\s*([\w\-]+)(?:[\s;]|\\n)*"\s*$/mi))){ | ||
charset = (charset[1] || "iso-8859-1").toString(). | ||
if((match = headers.match(/[; ]charset\s*=\s*([\w\-]+)(?:[\s;]|\\n)*"\s*$/mi))){ | ||
charset = (match[1] || "iso-8859-1").toString(). | ||
replace(/^utf(\d+)$/i, "utf-$1"). | ||
@@ -45,0 +45,0 @@ toLowerCase().trim(); |
{ | ||
"name": "node-gettext", | ||
"description": "Gettext client for Node.js to use .mo files for I18N", | ||
"version": "0.2.8", | ||
"version": "0.2.9", | ||
"author" : "Andris Reinman", | ||
@@ -6,0 +6,0 @@ "maintainers":[ |
@@ -419,2 +419,26 @@ var testCase = require('nodeunit').testCase, | ||
} | ||
} | ||
exports["BUG-POParser#_detectCharset-PO"] = { | ||
"parse PO": function(test){ | ||
fs.readFile(__dirname+"/utf8_bug_poparser.po", function(err, body){ | ||
if(err){ | ||
throw err; | ||
} | ||
test.doesNotThrow(function(){ | ||
test.p = new POParser(body); | ||
}); | ||
test.done(); | ||
}); | ||
}, | ||
"detect utf-8 charset": function(test){ | ||
fs.readFile(__dirname+"/utf8_bug_poparser.po", function(err, body){ | ||
if(err){ | ||
throw err; | ||
} | ||
test.p = new POParser(body); | ||
test.equal(test.p._charset, 'utf-8'); | ||
test.done(); | ||
}); | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Non-existent author
Supply chain riskThe package was published by an npm account that no longer exists.
Found 1 instance in 1 package
88776
16
2542
0