| Summary: | points are saved with , instead of . in e.g. french locale | ||
|---|---|---|---|
| Product: | [Unmaintained] koffice | Reporter: | Nicolas Arnaud-Cormos <nikikko> |
| Component: | general | Assignee: | David Faure <faure> |
| Status: | RESOLVED FIXED | ||
| Severity: | normal | CC: | t.zachmann |
| Priority: | NOR | ||
| Version First Reported In: | git | ||
| Target Milestone: | --- | ||
| Platform: | Ubuntu | ||
| OS: | Linux | ||
| Latest Commit: | Version Fixed/Implemented In: | ||
| Sentry Crash Report: | |||
|
Description
Nicolas Arnaud-Cormos
2006-05-08 23:41:48 UTC
Change severity to normal as it is not a crash. The problem you describe is allready fixed in svn and will be in koffice 1.5.1. I have had a look at the open doc file http://nikikko.free.fr/temp/kpresenter/bug-image-pen.odp but the image has no width/hight for me. Looks like I hid a different bug here. Which locale are you using? I'm using french locale. The image is 400x100. It is placed in the upper left corner. I have attached the image here : http://nikikko.free.fr/temp/kpresenter/bug-image-pen.png I have forgotten... Thank you for the fix, do I have to close the bug now ? No please let it open because of the other bug I found. Change title to have give the correct description about the problems of saving in e.g. French locale. See output of oasislint /home/hugo/test2/styles.xml:31:171: error: bad value for attribute "width" from namespace "urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" /home/hugo/test2/styles.xml:31:171: error: bad value for attribute "height" from namespace "urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" and here is the coresponding line to the errors: <draw:frame presentation:style-name="pr1" draw:id="object1" svg:width="299,999999999976pt" svg:height="74,999999999994pt" svg:x="0pt" svg:y="0pt" draw:name="Image"> @David: Can you please have a look at this This seems - impossible ... svg:width is saved using KoXmlWriter::addAttributePt, which calls QCString::setNum, which uses "." as decimal separator, always. This is locale-independent. At least in my Qt-3.3.5. Which version of Qt do you use exactly? My systems : Kubuntu dapper beta up-to-date (all upgrades) KDE 3.5.2, KPresenter 1.5 Qt 3.3.6 I tried to change the local in KDE for US English, but no effect. So I tried to change the LANG variable (fr_FR.UTF-8 => en_GB.UTF-8) : export LANG=en_GB.UTF-8 && kpresenter And it's working now, there "." instead of "," in the xml. Maybe it's an ubuntu bug... if you need more information, don't hesitate. > Qt 3.3.6 I downloaded Qt 3.3.6, the code in QCString::setNum(double) hasn't changed, still using "." unconditionally. > So I tried to change the LANG variable (fr_FR.UTF-8 => en_GB.UTF-8) : > export LANG=en_GB.UTF-8 && kpresenter > > And it's working now, there "." instead of "," in the xml. Huh. And if you export LANG to fr_FR.UTF-8 the problem is back? > Maybe it's an ubuntu bug... if you need more information, don't hesitate. Is there a way to check for ubuntu patches to Qt? I guess this would be in the src package for qt, right? Can you compile this test program and run it? #include <qcstring.h> #include <stdio.h> #include <float.h> #include <assert.h> int main() { QCString str; str.setNum( 123.4567, 'g', DBL_DIG ); qDebug( "%s", str.data() ); assert( str == "123.4567" ); return 0; } Save it into a file like qcstring.cpp, in an empty directory called qcstring; then do qmake -project ; qmake ; ./qcstring Do you see "123.4567" or do you get an assertion failure? I meant qmake -project ; qmake ; make ; ./qcstring of course On Tuesday 09 May 2006 19:55, David Faure wrote:
> I downloaded Qt 3.3.6, the code in QCString::setNum(double) hasn't changed, still using "." unconditionally.
Oh, I misread that code. The "." is only a format string, after that it calls sprintf, which might very well do locale-dependent things indeed....
OK don't bother - I can reproduce the problem now. Fix coming up. SVN commit 539110 by dfaure:
Fix for "points are saved with , instead of . in e.g. french locale".
QCString has very unexpected side effects due to it calling sprintf, but it's too late to fix that in Qt.
Qt4's QByteArray doesn't have this problem
BUG: 126990
M +4 -1 KoGlobal.cpp
--- branches/koffice/1.5/koffice/lib/kofficecore/KoGlobal.cpp #539109:539110
@@ -32,8 +32,8 @@
#include <kimageio.h>
#include <kiconloader.h>
#include <kstandarddirs.h>
+#include <locale.h>
-
KoGlobal* KoGlobal::s_global = 0L;
static KStaticDeleter<KoGlobal> sdg;
@@ -47,6 +47,9 @@
KoGlobal::KoGlobal()
: m_pointSize( -1 ), m_kofficeConfig( 0L )
{
+ // Make sure that QCString::setNum doesn't give us "," as decimal point, e.g. when saving to OpenDocument.
+ setlocale( LC_NUMERIC, "C" );
+
// Install the libkoffice* translations
KGlobal::locale()->insertCatalogue("koffice");
You are really too fast for me ;) Thank you ! As a side effect of this bug, my presentation is completely messy when I change the locale and open with KPresenter, or when I open with OpenOffice. I have to unzip the odp file, to change all "," in "." in the xml files and to zip back. Just a note for those who have the problem. A simpler workaround: open in kpresenter, save as .kpr, export LC_NUMERIC=C , reopen .kpr in kpresenter, save as .odp again. |