Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

node-gettext

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-gettext - npm Package Compare versions

Comparing version 0.2.8 to 0.2.9

test/utf8_bug_poparser.po

8

lib/poparser.js

@@ -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();
});
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc