smhg / gettext-parser

Parse and compile gettext po and mo files, nothing more, nothing less
MIT License
158 stars 44 forks source link

Fails to recognize charset using a minimal header #24

Closed beck closed 5 years ago

beck commented 7 years ago

When using the header:

msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Content-Type: text/plain; charset=UTF-8\n"

The charset is recognized as:

iso-8859-1

But adding another header, or swapping the two headers results in utf-8 so long as charset is not the final header.

I believe the issue lies in this regex: https://github.com/smhg/gettext-parser/blob/c575146b2956899352e6acfccb081be583555cfa/lib/poparser.js#L82

smhg commented 7 years ago

Thanks for the report! I recently took over this project and will follow up on this.