Archive: & Character replacement bug


& Character replacement bug
When I define MUI_PRODUCT with an '&' symbol it dows not display correctly in the dialog texts of MUI. However if I define it as '&&' it works correctly except in the title bar of the program.

Vytautas


GM.

not unusual - & marks the hotkey (ALT + key). i case i need a '&' in some ressources i also have to put a '&&' (also in strings)


I did realize that, however how do I get rid of the double '&&' in the title bar of the installer?

Vytautas


hmm - does "\$&" help?


No, there is no current solution I know of. Joost was going to add a solution, but I'm not sure if he did... You'll have to wait for his answer.


Can this be achieved by modifying the language or system.nsh script temporarily?


I don't think so. I think that the problem is related to windows itself handling '&' characters differently depending on the control type. Thus to fix this problem we would need to modify the string depending on the control type.

Vytautas


Indeed Vytautas. That will be done in NSIS (not just MUI) soon, hopefully.


How long will it be before it may be solved? I was noticing this myself...

I'm going to have to make installers for about 2 dozen different products in the next week or two that all have "&" in either their title, or in an installed file name. (The file is a number of megs , so it will be on-screen for long enough to notice. And, no, I can't change the filename at this point in time...)

Is there any workaround that may work? If nothing else, I'll just not say anything and hope no one notices... ;)


You can use && in the name and manually use & in the places that will show && which are the caption and the abort warning message box. To set the caption use Caption and UninstCaption (or whatever the MUI uses, if using the MUI) and the MUI define that sets the abort warning message.

I don't know exactly when I or someone else will to fully implementing the workaround for it.


But how do I do this for the files being installed? As I said, I can't rename them at this stage.


Hmm... Right, there is the log too :(

You will have to use DetailPrint for now, one for the text and one for the list.


Hm. I'll look into it. I think I'll just take the lazy way out and leave it stock (as much as possible) unless someone says something before the masters are sent off. If no one here notices, then we should be fine. ;)


OK... In the latest CVS version I have added another parameter for Name that allows you to specify a name that will be used where double ampersands are required. From the updated documentation:

If you have one or more ampersands (&) in the name, set the second parameter to the same name, only with doubled ampersands. For example, if your product's name is "Foo & Bar", use:
Name "Foo & Bar" "Foo && Bar"
If you have ampersands in the name and use a LangString for the name, you will have to create another one with doubled ampersands to use as the second parameter.
I have also added the SS_NOPREFIX style to the static control above the install log to solve lewellyn's issue.

I have tested it with ClearType and didn't notice any problems like last time. But I am not sure I followed the right steps so I'll check it again with Joost tomorrow. Let me know if texts are drawn on pages they shouldn't in weird places because of this update.

BTW, if you're wondering why the Name conversion is not automatic drop by the IRC channel for a possibly long explanation.