Bug 199005

Summary: Unable to escape \n
Product: [Applications] kdialog Reporter: Andreas Stangl <andreas-stangl>
Component: generalAssignee: Brad Hards <bradh>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: 1.0   
Target Milestone: ---   
Platform: Gentoo Packages   
OS: Linux   
Latest Commit: Version Fixed In: 4.9
Sentry Crash Report:
Attachments: Unable to escape \n

Description Andreas Stangl 2009-07-05 13:14:19 UTC
Version:           1.0 (using KDE 4.2.4)
Compiler:          gcc-4.3.3 CBUILD="x86_64-pc-linux-gnu" CFLAGS="-march=native -O2 -pipe -fomit-frame-pointer"m CHOST="x86_64-pc-linux-gnu"
OS:                Linux
Installed from:    Gentoo Packages

It seems that kdialog can not identify escaped \n (= \\n), the \n is does always result in a newline. When I try to replace the backslash character with the html entity &#92; then #92; is displayed instead of the backslash. (see screenshot)

I came up to this problem when trying to display a windows-like path that is passed to wine.
Comment 1 Andreas Stangl 2009-07-05 13:16:19 UTC
Created attachment 35062 [details]
Unable to escape \n

The upper kdialog call is unable to escape \n via \\n.
The lower call shows that kdialog can not translate the html entity for a backslash.
Comment 2 Pino Toscano 2009-07-05 13:48:22 UTC
$ kdialog --sorry 'foo<press Enter>
> oob'
Comment 3 Andreas Stangl 2009-07-05 14:30:21 UTC
(In reply to comment #2)
> $ kdialog --sorry 'foo<press Enter>
> > oob'

What do you mean with this? I want to display a string like 'foo\noob', i.e. the path 'C:\program files\notepad'
Comment 4 Pino Toscano 2009-07-06 00:37:13 UTC

*** This bug has been marked as a duplicate of bug 148575 ***
Comment 5 Andreas Stangl 2009-07-06 07:27:04 UTC
bug 148575 means that \n is _not_ translated to a newline, this is the other way around: \n cannot be escaped, therefore it is not possible to have the _string_ \n inside a dialog _without_ being translated to a newline. Any \n inside a string _is_ translated into a newline.
Comment 6 Andreas Stangl 2009-07-06 07:28:56 UTC
bug 148575 means that \n is _not_ translated to a newline, this is the other way around: \n cannot be escaped, therefore it is not possible to have the _string_ \n inside a dialog _without_ being translated to a newline. Any \n inside a string _is_ translated into a newline.
Comment 7 Andreas Stangl 2009-07-06 07:46:53 UTC
sorry for the double post, it seems bugs.kde.org has some network/database troubles or my network connection is very bad :-(
Comment 8 Oswald Buddenhagen 2012-07-01 11:20:30 UTC
Git commit 03e91d5242ac80c4923fc55f7e9c27a0acbcb762 by Oswald Buddenhagen.
Committed on 01/07/2012 at 12:39.
Pushed by ossi into branch 'master'.

make backslashes escapable
FIXED-IN: 4.9

M  +1    -6    kdialog/kdialog.cpp
M  +32   -0    kdialog/widgets.cpp
M  +1    -0    kdialog/widgets.h

http://commits.kde.org/kde-baseapps/03e91d5242ac80c4923fc55f7e9c27a0acbcb762
Comment 9 Christoph Feck 2012-07-02 14:48:39 UTC
Git commit b619b55abcefd1b28fc47644030de69f6fdccda1 by Christoph Feck, on behalf of Oswald Buddenhagen.
Committed on 01/07/2012 at 12:39.
Pushed by cfeck into branch 'KDE/4.9'.

make backslashes escapable
FIXED-IN: 4.9
(cherry picked from commit 03e91d5242ac80c4923fc55f7e9c27a0acbcb762)

M  +1    -6    kdialog/kdialog.cpp
M  +32   -0    kdialog/widgets.cpp
M  +1    -0    kdialog/widgets.h

http://commits.kde.org/kde-baseapps/b619b55abcefd1b28fc47644030de69f6fdccda1