Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix a bug in POParser#_detectCharset extracting the charset from .po …

…headers. String#match on a substring needs to by incremented by the starting position or the entire header block is not captured. This causes unpredicable failure depending on how many lines the header block has and where within the header block the "charset" string is; it might be within the part captured or it might not.
  • Loading branch information...
commit f5416e2ab81566e03500a5cc2e559971cf0be5cb 1 parent ae8caa3
@danmactough danmactough authored
Showing with 1 addition and 1 deletion.
  1. +1 −1  lib/poparser.js
View
2  lib/poparser.js
@@ -32,7 +32,7 @@ POParser.prototype._detectCharset = function(){
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);
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.