Pull Request #161 Detect and report incorrectly delimited strings

Strings in pofiles are always delimited on both ends with double-quotes.
The POFile parser in polib didn't check for this, and therefore happily
accepted invalid msgstr/msgid/etc, potentially loosing some of the
contents of the file. In such cases, the first or last character of the
string would be lost, as *they* would be considered the string delimiters.

This commit adds a check to the POFile parser to ensure strings are
always delimited by double quotes on both ends. After adding it, I
spotted a couple of offending po file contents in the tests, which have
also been fixed. Additionally, a new test had been added to ensure these
cases are caught. The new test indeed fails if the new check is removed.

This issue was found while investigating an error produced by the
"powrap" tool while running it over the po files for the Spanish
translation of the CPython documentation. The tool failed check one of
our files because gettext's `msgcat` utility failed to parse the file.
Upon closer inspection I realised the error in our pofile, which was
caught by gettext but not polib.

Signed-off-by: Rodrigo Tobar <rtobar@icrar.org>

 avatar rtobar

Pull request event #59 passed

  • Ran for
  • New branch build
AMD64
no language set
Git

Sorry, we're having troubles fetching jobs. Please try again later.