Bug 38176 - FILESAVE as RTF adds normal space after each non-breaking space
Summary: FILESAVE as RTF adds normal space after each non-breaking space
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
3.3.0 release
Hardware: All All
: medium normal
Assignee: Miklos Vajna
URL:
Whiteboard: target:3.6.0 target:3.5.4
Keywords:
Depends on:
Blocks: mab3.5
  Show dependency treegraph
 
Reported: 2011-06-11 00:04 UTC by cl75
Modified: 2012-05-19 09:52 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
The document is saved but still opened (86.20 KB, image/jpeg)
2011-06-11 00:04 UTC, cl75
Details
While re-opening the file (86.05 KB, image/jpeg)
2011-06-11 00:05 UTC, cl75
Details

Note You need to log in before you can comment on or make changes to this bug.
Description cl75 2011-06-11 00:04:45 UTC
Created attachment 47838 [details]
The document is saved but still opened

Hello,

When opening a document in Writer, which has been saved with Writer in RTF format, the program adds a normal space after each non-breaking space of the document. The error occurs each time I open the file, so that after ten openings there is still one non-breaking space but with ten normal spaces.

The bug is the same in Libo 3.3.2 final and OOo 3.3.3 final.

I have put two screenshots, one when the file is yet saved but still opened, one after a new opening of the document.

Thanks !
Comment 1 cl75 2011-06-11 00:05:39 UTC
Created attachment 47839 [details]
While re-opening the file

The new normal spaces added to the non-breaking spaces are now visible.
Comment 2 Jean-Baptiste Faure 2011-12-17 17:21:06 UTC
I confirm the problem with LO 3.5.0 beta-1 under Ubuntu 10.04 x86_64.
(LibreOffice 3.5.0beta1+ Build ID: 6e7299d-7f15fca-8eae9f1-ca8e46d-5bcbce4)

Best regards. JBF
Comment 3 Björn Michaelsen 2011-12-23 12:27:53 UTC
[This is an automated message.]
This bug was filed before the changes to Bugzilla on 2011-10-16. Thus it
started right out as NEW without ever being explicitly confirmed. The bug is
changed to state NEEDINFO for this reason. To move this bug from NEEDINFO back
to NEW please check if the bug still persists with the 3.5.0 beta1 or beta2 prereleases.
Details on how to test the 3.5.0 beta1 can be found at:
http://wiki.documentfoundation.org/QA/BugHunting_Session_3.5.0.-1

more detail on this bulk operation: http://nabble.documentfoundation.org/RFC-Operation-Spamzilla-tp3607474p3607474.html
Comment 4 Jean-Baptiste Faure 2011-12-26 00:54:46 UTC
Problem still there in LO 3.5.0 beta2+ (LibreOffice 3.5.0beta2+ Version ID : 8f03437-7f15fca-1fc8c06-ca8e46d-b96fade).

Cedric: it seems that you know well non-breaking spaces ;-) Please, feel free to reassign if you can't handle this.

Best regards. JBF
Comment 5 Jean-Baptiste Faure 2012-03-19 11:57:01 UTC
Hi Miklos, could you have a look at this weird bug ?
Please feel free to reassign if you can't handle this bug.

Best regards. JBF
Comment 6 Laurent Balland 2012-04-24 01:44:18 UTC
Hello,

This bug is quite annoying in French texts, as non-breaking spaces are automatically added before double punctuation: ':', ';', '?', '!'
I propose to add it to Most Annoying Bugs list bug 37361.

About the bug itself, I think there is only a problem with FILESAVE: the extra space is added when saving in RTF and not when opening a RTF file. 
- When you open a file saved in RTF (LibO 3.5.3RC1) with another word processor (Word 2003), the extra space is already there
- When opening a RTF file containing non-breaking space (introduced with Word 2003) in LibO 3.5.3RC1, no extra spaces are present
Comment 7 Rainer Bielefeld Retired 2012-04-24 02:18:45 UTC
[Reproducible] with "LibreOffice 3.5.3.1 (RC1) German UI/Locale [Build-ID: 21cb047-d7e6025-9ba54fc-b4a51a8-f42372b] on German WIN7 Home Premium (64bit)

Confirm Laurent BP's observation, definitively FILESAVE problem.

Was already in LibO 3.3.3, LibO 3.3.0 Portable, but not in OOo3.3
Comment 8 Roman Eisele 2012-04-24 03:01:23 UTC
It's no suprise, but also

[Reproducible] with the MacOS X versions: LibreOffice 3.5.2.2 and LibreOffice 3.4.6, both with German UI, both running on MacOS X 10.6.8, German UI.

A little observation: the space after NBSP is added really mechanically, even
NBSP + NBSP + NBSP
is saved as
NBSP + Space + NBSP + Space + NBSP + Space
. Looking at the RTF file with a text editor, we see that after every '\~', there is just a plain ' ' (space).

This means, LibreOffice handles the '\~' like a so-called RTF control word which consists of '\' + Ascii letter(s) + delimiter; the delimiter, e.g. a space, is part of the control word and will therefore NOT be displayed/printed. But '\~' is not a control word, but a so-called RTF control symbol, which "consists of a backslash followed by a single, non-alphabetical character" (quoting Rich Text Format (RTF) Specification, Version 1.9.1, Introduction), and there should be no delimiter after it; therefore, if a space comes after \~, it is a real space.

Of course, I don't write this here to instruct anybody; people familiar to RTF (like Miklos) will know about these things much better than me! I just wanted to share my little observation with other non-RTF-experts, to spread a bit knowlegde about RTF and Co.

@Laurent BP:
Thank you very much for adding this one to the Most Annoying Bugs list; it is a fabulous candidate!
Comment 9 Miklos Vajna 2012-04-24 03:37:58 UTC
Reproduced, assign to me. To the OP: Please next time attach the bugdoc, not the screenshot of the bugdoc, it saves time for us to re-created the bugdoc based on the screenshot. ;-)
Comment 10 Laurent Balland 2012-04-24 03:41:15 UTC
@Roman: As you wrote
(In reply to comment #8)
> This means, LibreOffice handles the '\~' like a so-called RTF control word
I made some extra tests, and the problem appears to be the same with all
formating marks: non-breaking space, non-breaking hyphen, optional hyphen

Laurent BP
Comment 11 Not Assigned 2012-04-24 03:57:48 UTC
Miklos Vajna committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=ef7cc64d8b5044251d6e31ca24aeb0ac11818e5d

fdo#38176 fix RTF export of non-breaking space
Comment 12 Not Assigned 2012-04-24 04:10:18 UTC
Miklos Vajna committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=dfc7c67e464e57f5442365e193c56033af564d84

fdo#38176 fix RTF export of non-breaking hyphen and optional hyphen
Comment 13 Miklos Vajna 2012-04-24 04:13:08 UTC
Should be fixed in master, will cherry-pick to -3-5 as usual after some testing.

Marking as resolved in the meantime.
Comment 14 Roman Eisele 2012-04-24 06:44:45 UTC
@Miklos Vajna:
> Should be fixed in master, will cherry-pick to -3-5 as usual after some
> testing.

Wow, that was fast! Thank you!
Comment 15 Laurent Balland 2012-04-24 06:47:30 UTC
Thanks Miklos for this fast patch!
Does it solve in the meantime the problem with other formating marks: a space is also added after non-breaking hyphen and optional hyphen?
Comment 16 Jean-Baptiste Faure 2012-04-24 07:16:59 UTC
(In reply to comment #15)
> Thanks Miklos for this fast patch!
> Does it solve in the meantime the problem with other formating marks: a space
> is also added after non-breaking hyphen and optional hyphen?

Yes : see  comment 12 ;-)

Best regards. JBF
Comment 17 Not Assigned 2012-05-02 04:13:49 UTC
Miklos Vajna committed a patch related to this issue.
It has been pushed to "libreoffice-3-5":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=0fcd27f28aea1c850c8d8f11485b6a5d9bb974ea&g=libreoffice-3-5

fdo#38176 fix RTF export of non-breaking space/hyphen/optional hyphen


It will be available in LibreOffice 3.5.4.
Comment 18 s-joyemusequna 2012-05-19 09:52:15 UTC
Verified with LOdev 3.6 (master - 18-May-2012 02h44 x86@6-fast; Build ID: 8b1d29b) under Windows Vista 64.