Bug 150922

Summary: Lupdate interprets some octal escape sequences incorrectly
Product: [Fedora] Fedora Reporter: Daniel Tschan <tschan+redhat.com>
Component: qtAssignee: Ngo Than <than>
Status: CLOSED CURRENTRELEASE QA Contact: Ben Levenson <benl>
Severity: low Docs Contact:
Priority: medium    
Version: 3   
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2005-06-13 14:37:30 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Description Daniel Tschan 2005-03-12 00:28:11 UTC
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 14:37:30 UTC
it's already fixed in qt-3.3.4 (FC4)