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

Submitted by:  None
Submitted on:  Fri 25 Dec 2015 04:53:26 PM UTC  
Category: CSeverity: 4 - Important
Item Group: NoneStatus: Confirmed
Privacy: PublicAssigned to: None
Open/Closed: Open

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.



No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -unavailable- added by haible (Updated the item)
  • -unavailable- added by ueno (Posted a comment)

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.


    Please enter the title of George Orwell's famous dystopian book (it's a date):



    Follow 3 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sat 06 Jan 2018 05:56:21 PM UTChaibleSeverity3 - Normal=>4 - Important
    Sun 27 Nov 2016 12:08:13 PM UTChaibleCategoryNone=>C
    Fri 25 Dec 2015 11:36:06 PM UTCuenoStatusNone=>Confirmed

    Back to the top

    Powered by Savane 3.1-cleanup1