Spaces in filenames

This forum is for all Flare issues related to the HTML5, WebHelp, WebHelp Plus, and Adobe Air Targets
Post Reply
AlanKearns
Sr. Propeller Head
Posts: 103
Joined: Thu Sep 11, 2014 2:06 am

Spaces in filenames

Post by AlanKearns »

The way the 'Add File' dialog box defaults the first heading to the file name, has always made it convenient to use filenames with spaces in them (perhaps TOO convenient...). Given that I'm starting to produce output for webspace, would the world recommend:

* Doing nothing about this - Madcap have(?) thought of this and my site will be built with %20s instead, without me doing anything.
* Replacing all the spaces in my project with underscores in Flare (PDFs as well as Flare topics)
* Ticking the 'Replace reserved characters with underscores in filenames' in the target's Advanced section.
roboHAL
Sr. Propeller Head
Posts: 254
Joined: Mon Dec 31, 2012 9:57 am

Re: Spaces in filenames

Post by roboHAL »

You should not leave (seemingly) blank spaces in the file name. I reported a bug to Madcap in March whereby it was confirmed - and thankfully subsequently fixed - that the Add File dialog intermittently permitted "non-breaking spaces" for the filenames. This manifested itself as having (seemingly) duplicate files in the project. If you were to copy the file names from windows explorer into say MS Word and show paragraph marks, it could be seen that one file had an "unwanted ascii character" for lack of a better term. In fact, source control (TFS) reported an encoding difference and in some instances the project would not build successfully. See the image I uploaded as an example. I do not use these long names with spaces, this is merely an example.

The best (my opinion) of your choices is to use underscores in the source. I've used Flares replace reserved characters feature and it does work well. The caveat there is - as Madcap points out - if you're using international characters they too are converted. Explicitly using underscores at the source is also best because you could have a need for the source files to not have spaces. For example, if you use a list proxy and tag many alphabetically similar file names that have spaces, the resulting order may not be entirely alphabetically correct.
You do not have the required permissions to view the files attached to this post.
NorthEast
Master Propellus Maximus
Posts: 6426
Joined: Mon Mar 05, 2007 8:33 am

Re: Spaces in filenames

Post by NorthEast »

What's the anticipated issue with spaces?

I wouldn't have thought spaces would cause a problem with building the help in Flare, or viewing the output from a browser.
So are they not just problematic if URLs to your content are processed/parsed by third-party tools which haven't been coded well enough to deal with spaces?
roboHAL
Sr. Propeller Head
Posts: 254
Joined: Mon Dec 31, 2012 9:57 am

Re: Spaces in filenames

Post by roboHAL »

Hi Dave. I'll defer your first question to the original topic author Alan. As to your second point (causing build problems), I can only tell you that it was reproducible by myself and Madcap when the feature to convert reserved characters to underscores was selected and the seemingly duplicate file names exist. You can refer to Madcap bug 100217.
NorthEast
Master Propellus Maximus
Posts: 6426
Joined: Mon Mar 05, 2007 8:33 am

Re: Spaces in filenames

Post by NorthEast »

roboHAL wrote:Hi Dave. I'll defer your first question to the original topic author Alan. As to your second point (causing build problems), I can only tell you that it was reproducible by myself and Madcap when the feature to convert reserved characters to underscores was selected and the seemingly duplicate file names exist. You can refer to Madcap bug 100217.
Yep, I know there's a bug, but I wasn't suggesting to use that option.
If you just keep the spaces in filenames in the output, then that shouldn't cause any problems with the build or when you view the output in a browser.

In what sort of scenario do spaces cause problems?
roboHAL
Sr. Propeller Head
Posts: 254
Joined: Mon Dec 31, 2012 9:57 am

Re: Spaces in filenames

Post by roboHAL »

I apologize if indicating a bug number is not proper etiquette. On the bright side, I believe the bug has been fixed. In answer to your question, in my opinion its simply best practice to not use spaces. Perhaps asking the reverse of your question is in order. When and/or why would it be advantageous to use spaces - as opposed to underscores or no other character at all - in a file name?
kwag_myers
Propellus Maximus
Posts: 810
Joined: Wed Jul 25, 2012 11:36 am
Location: Ann Arbor, MI

Re: Spaces in filenames

Post by kwag_myers »

roboHAL wrote:Perhaps asking the reverse of your question is in order. When and/or why would it be advantageous to use spaces - as opposed to underscores or no other character at all - in a file name?
I think the OP answers that by referring to the practice of using the file name as the topic header. I've gotten in the habit of using CamelCase for file names. It's easy enough to copy/paste and add the spaces for the header.

As for problems caused, I've encountered issues with other editors that don't support them. So, unless you're married to Flare for life, switching editors may cause you some issues. Granted, that's probably a low-probability scenario. But how many of us have had the same desk for years yet worked for more than one company during that time? Those of us in software development know that change is a constant. Also, if you send files out for translation or other services, there may be a risk there as well.
"I'm tryin' to think, but nothin' happens!" - Curly Joe Howard
lstompor
Jr. Propeller Head
Posts: 1
Joined: Wed Sep 02, 2015 2:18 pm

Re: Spaces in filenames

Post by lstompor »

I don't have many details, but our translators are having trouble digesting files whose names inadvertently have the non-breaking space. Very annoying!

I can, of course, rename those files and take care to put a regular space, but how will the linking and context-sensitive help work? They are technically different file names, so I don't think I can just painlessly make the change...
kwag_myers
Propellus Maximus
Posts: 810
Joined: Wed Jul 25, 2012 11:36 am
Location: Ann Arbor, MI

Re: Spaces in filenames

Post by kwag_myers »

My first suggestion is to rename the files without spaces and make any necessary downstream adjustments, like editing the context-sensitive Help links. It may be very time consuming, but in the long run I think you'll appreciate the effort.

My second suggestion is a bit clunky, but if you're running into a deadline situation, this might help. Since I often take over projects having spaces in the file names, I developed a Visual Basic Script for just this situation:

Code: Select all

Dim sName
Dim fso
Dim fol

Set fso = WScript.CreateObject("Scripting.FileSystemObject")
    
' get current folder
Set fol = fso.GetFolder("C:\Users\kwag.myers\Documents\Project\Content")
' log files with spaces
Set NewFile = fso.CreateTextFile(fol&"\FileList.txt", True)

' go thru each file in the folder
For Each fil In fol.Files
    ' check if the file name contains spaces
    If InStr(1, fil.Name, " ") <> 0 Then
        ' log the file name
        NewFile.WriteLine(fil.Name)
        ' replace with underscore
        sName = Replace(fil.Name, " ", "_")
        ' rename the file
        fil.Name = sName
    End If
Next

WScript.Echo "Completed!"


Paste this code into NotePad and save the file with a .vbs extenstion, e.g., ReplaceSpacesFileName.vbs. Your file names will have underscores where the spaces were and you can send them to the translators. You can make another version of the script (changing lines 15 and 19) to put the spaces back in the translated files if you want.
"I'm tryin' to think, but nothin' happens!" - Curly Joe Howard
Feebeegeebee
Sr. Propeller Head
Posts: 213
Joined: Wed Aug 08, 2012 8:38 am
Location: UK

Re: Spaces in filenames

Post by Feebeegeebee »

Just a couple of points. It's better to avoid spaces, as it takes out the requirement for other tools to handle those spaces.
A few times I have created new topics and forgotten about the fact that spaces will occur by default and I have built my help output, checked it into our source control so that it is included in s/w builds and the spaces have caused our build system to grind to a halt and fail. It can also cause problems on non-Microsoft systems - e.g. Linux or Unix.

Also, one thing I remember from the Supercharging Search (https://www.madcapsoftware.com/demos/si ... 1028285987) webinar was the recommendation to use hyphens in file names, rather than running words together or using underscores. The reason for that is that the underscore is considered by some indexes to be its own word character. Also, some search engines may interpret an expression such as "Making_a_Start" as "MakingaStart". This means that keywords are less likely to be recognised, or even parsed properly by search engines.
So, I now try to use hyphens in file names.
-----------------------------------------------------
Using Flare 2022 on Windows 11 (64-bit)
-----------------------------------------------------
Post Reply