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:  C Severity:  4 - Important
Item Group:  None Status:  Confirmed
Privacy:  Public Assigned 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
  • -email is unavailable- added by haible (Updated the item)
  • -email is unavailable- added by ueno (Posted a comment)

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

    Only logged-in users can vote.




    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    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.3