Bug 129086

Summary: Konqueror Archive Web Page tool no longer automatically converts spaces to underscores
Product: [Applications] konqueror Reporter: Shriramana Sharma <samjnaa>
Component: generalAssignee: Konqueror Developers <konq-bugs>
Status: RESOLVED WORKSFORME    
Severity: minor CC: tyrerj, zahl
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: openSUSE   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: patch for revert and correction of a logical error

Description Shriramana Sharma 2006-06-13 11:04:50 UTC
Version:            (using KDE KDE 3.5.3)
Installed from:    SuSE RPMs
OS:                Linux

After upgrading to KDE 3.53, the Konqueror Archive-Web-Page tool no longer automatically converts spaces in the page title to underscores in the .war name.

For example, with KDE 3.52, if I go to

http://science.nasa.gov/headlines/y2006/09jun_moonlets.htm

in Konqueror and use Tools - Archive Web Page, the Save Page As dialog used to fill-in the file name as 

NASA_-_Corkscrew_Asteroids.war 

but now it fills it in as 

NASA - Corkscrew Asteroids.war

The space-to-underscore feature should not have been removed, since spaces can cause problems when using a shell on *nix. Leaving the spaces in is a Windows-style approach which is not all that commendable (at least in *nix) since spaces are treated as special characters on the command line unless enclosed in quotes.

Hmm... now that KDE is getting ported to Windows, perhaps Windows users would like to see the spaces as they are used to. But at least give us a checkbox option whether to convert the spaces or not, and the preference be remembered.

Thanks.
Comment 1 James Richard Tyrer 2006-06-16 12:18:12 UTC
I am confirming this and I think that it is a bug although I have rated it as only a minor one.
Comment 2 Shriramana Sharma 2006-06-19 18:02:19 UTC
The change was at line 85 of

/branches/KDE/3.5/kdeaddons/konq-plugins/webarchiver/plugin_webarchiver.cpp

archiveName = archiveName.replace( QRegExp("\\s+"), "_");

was changed to

archiveName = archiveName.replace( QRegExp("\\s+"), " ");

Look at http://websvn.kde.org/branches/KDE/3.5/kdeaddons/konq-plugins/webarchiver/plugin_webarchiver.cpp?rev=541035&view=log

The committer has written, "this isn't DOS". But it isn't Windows either. KDE has so far been on *nix systems. Only after now it will be ported to Windows.

As such, the use of the space should be discouraged. For your (future) Windows users, give them the space as a settable option, or maybe even as the default. For us *nix users, give us the underscore. Something like:

#if WORKINGINWINDOWS
  archiveName = archiveName.replace( QRegExp("\\s+"), " ");
#else
  archiveName = archiveName.replace( QRegExp("\\s+"), "_");
#endif

A slightly more complicated solution would be to add a checkbox to the dialog where the user can select whether s/he wants auto-conversion of spaces or not.

P.S: The person who undid this behaviour overlooked a couple of things:
1. He did not remove the following comment:
  // Replace space with underscore, proposed Frank Pieczynski <pieczy@knuut.de>
2. He did not notice that the following line exists:
  archiveName = archiveName.simplifyWhiteSpace();
thereby rendering his line totally superfluous. He should simply have deleted the line.

Attaching a patch for corrections.
Comment 3 Shriramana Sharma 2006-06-19 18:03:26 UTC
Created attachment 16701 [details]
patch for revert and correction of a logical error
Comment 4 Frank Pieczynski 2006-07-29 17:01:25 UTC
Please revert Revision 541035 ! It changes also only 3.5 line, in HEAD it's still ok (converting spaces to '_'). This conversion is a feature, not a bug.
Comment 5 Linus Östberg 2008-05-04 18:32:00 UTC
Resolved in 3.5.9.
Comment 6 A. Spehr 2008-07-06 00:39:19 UTC
It does underscores in 4.00.84