bug-gettext
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug #50472] msgfmt: bail out on \0 in msgid or msgstr


From: Bruno Haible
Subject: [bug #50472] msgfmt: bail out on \0 in msgid or msgstr
Date: Tue, 31 Dec 2024 16:32:35 -0500 (EST)

Update of bug #50472 (group gettext):

                  Status:                    None => Not a Bug
             Assigned to:                    None => haible
             Open/Closed:                    Open => Closed

    _______________________________________________________

Follow-up Comment #1:

The strings that are stored in PO and MO files are supposed to be able to
contain NUL characters, see
https://www.gnu.org/software/gettext/manual/html_node/MO-Files.html . This is
currently not the case (see bug #66624); nevertheless it would be wrong to
build such an error message into msgfmt.

The only solid way that I see, that would allow to reject NUL characters in
certain strings, is that strings which are used via C APIs that are supposed
to return NUL-terminated strings (like gettext(), dgettext()) are marked with
'#, c-string' in the POT file and then also in the PO file. The problem with
that approach is that more than 50% of the strings would carry this flag, and
the effect of this flag is very minor; thus this flag would clutter up PO
files more than it has advantages.

In fact, the original problem — accidental use of \0 instead of \\0 — is
due to the backslashing of strings in PO files. I see it as a feature of a
good PO editor to be clear about which backslashes are for the string and
which backslashes are for the PO file syntax. In other words, it's a
quality-of-implementation issue of the PO editor. (And yes, I know that the
Emacs po-mode does not have good quality in this sense: it leaves backslashes
from the PO file syntax visible to the translator.)


    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?50472>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]