ID:2622773
 
Resolved
The & character could cause problems in alert() boxes and some input() boxes due to the way Windows uses it as an escape in displayed text. For worlds compiled in 513 or newer, this will now be escaped properly.
BYOND Version:513
Operating System:Windows 10 Enterprise 64-bit
Web Browser:Firefox 78.0
Applies to:Dream Seeker
Status: Resolved (513.1534)

This issue has been resolved.
Descriptive Problem Summary:

Single ampersands in alert display cause alert MessageBox to produce weird results.

Numbered Steps to Reproduce Problem:

Code Snippet (if applicable) to Reproduce Problem:
mob
Login()
..()
alert(src,"Hello & Welcome!","Welcome!")

Produces: "Hello Welcome!"

mob
Login()
..()
alert(src,{"Hello & Welcome!"},"Welcome!")

Produces: Hello _ Welcome!

Expected Results:
Hello & Welcome

Actual Results:
See above;

Does the problem occur:
Every time? Or how often? Every time
In other games? Untested, presumably so.
In other user accounts? Unrelated
On other computers? Unable to test.

When does the problem NOT occur?
Double Ampersands will return the expected result.
mob
Login()
..()
alert(src,"Hello && Welcome!","Welcome!")

produces: "Hello & Welcome!"


Workarounds:

Use double ampersands.



I'm assuming this has something to do with window's default functionality for ampersands and buttons, or menus. as an {"O&K"} button will allow you to hit K to confirm dialog.
The first two snippets compile the exact same way so I don't think it's possible for you to see different behavior between them.

This would indeed be caused by Windows' hehavior for static text. It should be a simple fix.
The first two strangely yield different results demonstrated in the following images:
without {}


vs
with {}
In response to Inuyashaisbest
This baffles me because the two formats should compile to exactly the same string. Both versions will produce identical .dmb files.
Found out why it was doing it, when I would switch windows, I would use Alt + Tab, the Alt would trigger the underscore to appear highlighting the '&space' "menu" item.

My apologies, it was with how I was entering the window that was the difference.
Lummox JR resolved issue with message:
The & character could cause problems in alert() boxes and some input() boxes due to the way Windows uses it as an escape in displayed text. For worlds compiled in 513 or newer, this will now be escaped properly.