[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug #58356] xgettext does not escape special characters in comments
From: |
Guido Flohr |
Subject: |
[bug #58356] xgettext does not escape special characters in comments |
Date: |
Tue, 12 May 2020 06:53:21 -0400 (EDT) |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:75.0) Gecko/20100101 Firefox/75.0 |
URL:
<https://savannah.gnu.org/bugs/?58356>
Summary: xgettext does not escape special characters in
comments
Project: GNU gettext
Submitted by: gflohr
Submitted on: Tue 12 May 2020 10:53:19 AM UTC
Category: None
Severity: 3 - Normal
Item Group: None
Status: None
Privacy: Public
Assigned to: None
Open/Closed: Open
Discussion Lock: Any
_______________________________________________________
Details:
I have a C source file "two\nlines.c" (with an embedded newline character in
the name):
$ cat 'two
lines.c'
gettext("Hello, world!\n");
$ xgettext 'two
lines.c'
$ msgfmt messages.po
messages.po: warning: Charset "CHARSET" is not a portable encoding name.
Message conversion to user's charset might not work.
messages.po:21: keyword "lines" unknown
messages.po:21:6: syntax error
msgfmt: found 2 fatal errors
$ cat messages.po
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-05-12 11:52+0300\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <address@hidden>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
#: /tmp/two
lines.c:1
msgid "Hello, world!\n"
msgstr ""
Similarly, commas should be escaped, so that a source file "foo.c:42, bar.c"
would not result in two references.
It is, of course, not a valuable feature to be able to process filenames with
embedded commas or newlines. But the current state is that xgettext produces a
file without errors or warnings that msgfmt cannot parse.
A simple solution would be to just throw a fatal error for such cases.
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?58356>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
- [bug #58356] xgettext does not escape special characters in comments,
Guido Flohr <=