bugGNU gettext - Bugs: bug #50472, msgfmt: bail out on \0 in msgid or...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

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

Submitter:  Roland Illig <rillig>
Submitted:  Mon 06 Mar 2017 07:49:01 PM UTC
   
 
Category:  Translator tools Severity:  3 - Normal
Item Group:  None Status:  Not a Bug
Privacy:  Public Assigned to:  haible
Open/Closed:  Closed

Tue 31 Dec 2024 09:32:29 PM UTC, 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.)

Bruno Haible <haible>
Group administrator
Mon 06 Mar 2017 07:49:01 PM UTC, original submission:  

The escape sequence \0 doesn't make sense in either msgid or msgstr string literals. Therefore it should be forbidden.

See https://github.com/vslavik/poedit/issues/344

Roland Illig <rillig>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by haible (Posted a comment)
  • -email is unavailable- added by fitojb
  • -email is unavailable- added by rillig (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2024-12-31 haible Open/ClosedOpen Closed
    2024-12-31 haible StatusNone Not a Bug
        Assigned toNone haible
    2017-03-11 fitojb Carbon-Copy- Added fitojb

    Back to the top

    Powered by Savane 3.15-e6e5.
    Corresponding source code