bugGNU gettext - Bugs: bug #46756, xgettext 0.19.6 mangles C escapes;...


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

bug #46756: xgettext 0.19.6 mangles C escapes; causes po file corruption

Submitter:  None
Submitted:  Fri 25 Dec 2015 04:53:26 PM UTC
Category:  C Severity:  4 - Important
Item Group:  None Status:  Fixed
Privacy:  Public Assigned to:  haible
Open/Closed:  Closed

Thu 09 May 2019 07:20:43 PM UTC, comment #4: 

The fix is contained in the gettext-0.20 release.

Bruno Haible <haible>
Project Administrator
Mon 05 Nov 2018 07:30:21 AM UTC, comment #3: 

This is a huge amount of effort; thank you for working on that!

Daiki Ueno <ueno>
Project Administrator
Sun 04 Nov 2018 11:32:36 PM UTC, comment #2: 

This is fixed now.

> it is not straightforward to fix this, now that the \u escape is introduced.

The \u parsing (changes from 2014-05-02) were OK in this respect. The problem were the "interpret string literals lazily" changes from 2014-05-07 and 2014-05-09.

I reverted these changes, added a couple of additional tests, and then made changes until all tests passed.

Bruno Haible <haible>
Project Administrator
Fri 25 Dec 2015 11:36:06 PM UTC, comment #1: 

Yes, this is certainly a regression and the character escapes should be converted before concatenating adjacent strings.

However, it is not straightforward to fix this, now that the \u escape is introduced.  I guess it would be ideally fixed by consolidating encoding conversion stuff (currently in xgettext.c) into character escape handling (x-c.c) and do that before string concatenation.

In any case, an easy work around is to use octal escapes.

Daiki Ueno <ueno>
Project Administrator
Fri 25 Dec 2015 04:53:26 PM UTC, original submission:  

(also sent to mailing list)

welinder@lenovo ~/temp $ cat foo.c
char *x = N_("Jean Br\xc3\xa9""fort");
welinder@lenovo ~/temp $ cat POTFILES.in

welinder@lenovo ~/temp $ /usr/bin/xgettext --version
xgettext (GNU gettext-tools) 0.18.3
welinder@lenovo ~/temp $ /usr/bin/xgettext --keyword=N_
"--add-comments" "--directory=." "--default-domain=foo"
"--from-code=UTF-8" "--files-from=./POTFILES.in"
welinder@lenovo ~/temp $ grep Jean foo.po
msgid "Jean Bréfort"

### That's "Jean Bre\'efort" in there.

With 0.19.6 we get...

welinder@lenovo ~/temp $ xgettext --version
xgettext (GNU gettext-tools) 0.19.6
welinder@lenovo ~/temp $ xgettext --keyword=N_ "--add-comments"
"--directory=." "--default-domain=foo" "--from-code=UTF-8"
welinder@lenovo ~/temp $ grep Jean foo.po
msgid "Jean Brßort"

### Instead of et e' we now have a German double-s.  And the f is gone.



(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 (Updated the item)
  • -email is unavailable- added by ueno (Posted a comment)

    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 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2018-11-04 haible StatusConfirmed Fixed
        Assigned toNone haible
        Open/ClosedOpen Closed
    2018-01-06 haible Severity3 - Normal 4 - Important
    2016-11-27 haible CategoryNone C
    2015-12-25 ueno StatusNone Confirmed

    Back to the top

    Powered by Savane 3.9