Bug 65405 - French usage requires en dash surrounded by unbreakable spaces
Summary: French usage requires en dash surrounded by unbreakable spaces
Status: RESOLVED WONTFIX
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Localization (show other bugs)
Version:
(earliest affected)
4.0.2.2 release
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-06-05 09:30 UTC by Alessandro Ceschini
Modified: 2017-03-06 17:02 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:


Attachments
character replacement in Writer (32.83 KB, image/png)
2013-12-30 16:52 UTC, Luc
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alessandro Ceschini 2013-06-05 09:30:45 UTC
Hello everybody,

If I type space+--+space I get space+en dash+space thanks to the replacement table of Autocorrect, but this is typographically inappropriate, I should rather get unbreakable space+en dash+unbreakable space.

That is, spaces too should be replaced. Unfortunately there's no way for me to get the replacement table to do this. I believe the insertion of unbreakable spaces should be turned on by default or, at least, users should be able enable this substitution manually.
Comment 1 Alessandro Ceschini 2013-06-06 13:14:03 UTC
Actually, I'm wondering whether the "Replaces dashes" entry in the Options tab should take care of it. That means that, for instance, 12--13 should give unbreakable space+en dash+unbreakable space. At the moment, it gives just an em dash which is completely inappropriate, at least in French.
Comment 2 Alessandro Ceschini 2013-06-07 17:06:29 UTC
I changed the title because I think this issue is specific to French, in English normal spaces with en-dash should be OK.
Comment 3 tommy27 2013-10-10 20:30:12 UTC
hi, is it still an issue with 4.1.2.3?
Comment 4 Luc 2013-12-30 16:52:17 UTC
Created attachment 91338 [details]
character replacement in Writer
Comment 5 Luc 2013-12-30 16:58:31 UTC
LibreOffice 
Versie: 4.2.0.1 
Build ID: 7bf567613a536ded11709b952950c9e8f7181a4a

The AutoCorrect table has "insert unbreakable space in French text" 
switched on by Default ( see attachment "character replacement in Writer".

I am unsure if behaviour is wrong or good. Alessandro can you help?
Comment 6 Alessandro Ceschini 2014-01-10 11:45:38 UTC
(In reply to comment #3)
> hi, is it still an issue with 4.1.2.3?

Hello tommy27!

Yes, with 4.1.3.2 it still is.
Comment 7 Alessandro Ceschini 2014-01-10 11:48:55 UTC
(In reply to comment #5)
> LibreOffice 
> Versie: 4.2.0.1 
> Build ID: 7bf567613a536ded11709b952950c9e8f7181a4a
> 
> The AutoCorrect table has "insert unbreakable space in French text" 
> switched on by Default ( see attachment "character replacement in Writer".
> 
> I am unsure if behaviour is wrong or good. Alessandro can you help?

Hello Luc!

Yes, this function ought to be enabled, but unfortunately it doesn't apply to dashes, it works with colons, semicolons, exclamation marks, question marks and quotation marks, but not with dashes.

Too bad.
Comment 8 Julien Nabet 2014-05-02 07:35:07 UTC
On pc Debian x86-64 with master sources updated today, I can reproduce this.

Eike: any idea/codepointer?
Comment 9 Julien Nabet 2014-05-02 08:13:41 UTC
I found in editeng/source/misc/svxacorr.cxx this:
    613 bool SvxAutoCorrect::FnAddNonBrkSpace(
    614                                 SvxAutoCorrDoc& rDoc, const OUString& rTxt,
    615                                 sal_Int32, sal_Int32 nEndPos,
    616                                 LanguageType eLang )
    617 {
    618     bool bRet = false;
    619 
    620     CharClass& rCC = GetCharClass( eLang );
    621 
    622     if ( rCC.getLanguageTag().getLanguage() == "fr" )
    623     {
    624         bool bFrCA = (rCC.getLanguageTag().getCountry() == "CA");
    625         OUString allChars = ":;?!%";

I tried to insert a dash in allChars but make debugrun indicated this:
warn:rtl.string:16396:1:sal/rtl/strtmpl.cxx:1269: rtl_uString_newFromLiteral - Found char > 127
So I tried this:
bool bIsSpecial = (allChars.indexOf( cChar ) != -1) || (cChar == '–');
but had:
/home/julien/compile-libreoffice/libreoffice/editeng/source/misc/svxacorr.cxx:632:74: error: multi-character character constant [-Werror=multichar]
         bool bIsSpecial = (allChars.indexOf( cChar ) != -1) || (cChar == '–');
Comment 10 Julien Nabet 2014-05-02 09:59:47 UTC
I succeeded in building this part by using OUString but it still fails.
Quite stuck now:-(
Comment 11 Andras Timar 2014-06-22 13:48:37 UTC
(In reply to comment #9)

OUString aNbsp("\xc2\xa0", 2, RTL_TEXTENCODING_UTF8);
Comment 12 Julien Nabet 2014-06-22 15:51:17 UTC
Thank you Andras for the tip.
I used it, then I noticed too SvxAutoCorrect::NeedsHardspaceAutocorr and added this test:
cChar == ((sal_Unicode) 0x2013)

But even with this, we don't enter in FnAddNonBrkSpace.
I'm not sure but perhaps it's because en-dash is already the result of an autocorrection.
Comment 13 Julien Nabet 2014-06-24 20:05:27 UTC
I'm stuck here, even when typing unicode with Ctrl+Shift+U then 2013, I don't succeed in replacing the space by unbreaking space before en-dash.
Comment 14 László Németh 2014-08-01 00:08:25 UTC
As long as the unbreakable space is a fixed width space, it has to be optional to keep the justification, see bug 41652.
Comment 15 tommy27 2014-08-04 06:17:56 UTC
please grab an august 4.4.x daily build and test new wildcard autocorrect patterns as described in https://bugs.freedesktop.org/show_bug.cgi?id=55292#c19

we need to know if the new feature may have side effects with french punctuation and unbreakable spaces.
Comment 16 tommy27 2015-07-28 05:49:56 UTC
please French users give an update of this bug current status and tell if things changed using wildcard patterns (see https://goo.gl/8uDZOX ) or the new emoji feature (available just in 5.0.0 see: https://goo.gl/LA5XzK )
Comment 17 Julien Nabet 2015-08-01 17:04:49 UTC
On pc Debian x86-64 with master sources updated today, I could still reproduce this.
Comment 18 QA Administrators 2017-03-06 15:43:58 UTC Comment hidden (obsolete)
Comment 19 Olivier R. 2017-03-06 16:35:02 UTC
This request should be dropped and closed.

In some cases only, there is a need for unbreakable spaces before and after the en-dash.

But in many cases, it’s required to add an unbreakable space after the en-dash and a normal space before (opening dash), and an unbreakable before the en-dash and a normal space after (closing dash).

Example:
Ils ont – quoi qu’il arrive à présent – perdu la partie.

In the “Lexique des règles typographiques de l’Imprimerie nationale”, no unbreakable spaces are required before and after.

As it’s not possible to guess what the user want to do, we should do nothing.
Comment 20 tommy27 2017-03-06 17:02:13 UTC
good explanation.
I set status to WONTFIX