This service will be undergoing maintenance at 00:00 UTC, 2016-08-01. It is expected to last about 1 hours
Bug 150922 - Lupdate interprets some octal escape sequences incorrectly
Lupdate interprets some octal escape sequences incorrectly
Status: CLOSED CURRENTRELEASE
Product: Fedora
Classification: Fedora
Component: qt (Show other bugs)
3
i386 Linux
medium Severity low
: ---
: ---
Assigned To: Ngo Than
Ben Levenson
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2005-03-11 19:28 EST by Daniel Tschan
Modified: 2007-11-30 17:11 EST (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2005-06-13 10:37:30 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)

  None (edit)
Description Daniel Tschan 2005-03-11 19:28:11 EST
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.6) Gecko/20050302 Firefox/1.0.1 Fedora/1.0.1-1.3.2

Description of problem:
Lupdate interprets three-digit octal escape sequences followed by an octal digit incorrectly. The following minimal C++ program (ltest.cpp) can be used to reproduce the error:

#include <iostream>
#include <qapplication.h>

int main( int argc, char* argv[] )
{
  QApplication app( argc, argv );
  std::cout << app.translate( "", "\0421", "", QApplication::UnicodeUTF8 ) << std::endl;
}

According to Bjarne Stroustrup's "The C++ Programming Language", 3rd edition, appendix C, section 3, subsection 2 an octal escape sequence is at most three digits long. Which means additional octal digits have to be interpreted as ordinary characters. If you compile ltest.cpp using

g++ -I/usr/lib/qt-3.3/include -L/usr/lib/qt-3.3/lib -lqt-mt ltest.cpp

and run it, it correctly outputs a double quote (octal 42) followed by the number one.

lupdate however inteprets the string "\0421" as four-digit octal escape sequence.


Version-Release number of selected component (if applicable):
qt-designer-3.3.3

How reproducible:
Always

Steps to Reproduce:
1. lupdate ltest.cpp -ts ltest.ts
2. cat ltest.ts
3.
  

Actual Results:  <!DOCTYPE TS><TS>
<context>
    <name></name>
    <message>
        <source><byte value="x11"/></source>
        <translation type="unfinished"></translation>
    </message>
</context>
</TS>


Expected Results:  <!DOCTYPE TS><TS>
<context>
    <name></name>
    <message>
        <source>&quot;1</source>
        <translation type="unfinished"></translation>
    </message>
</context>
</TS>


Additional info:

This error can be workarounded by isolating octal escape sequences into their own string literals.

#include <iostream>
#include <qapplication.h>

int main( int argc, char* argv[] )
{
  QApplication app( argc, argv );
  std::cout << app.translate( "", "\042""1", "", QApplication::UnicodeUTF8 ) << std::endl;
}
Comment 1 Ngo Than 2005-06-13 10:37:30 EDT
it's already fixed in qt-3.3.4 (FC4)

Note You need to log in before you can comment on or make changes to this bug.