Jump to content

MsgBox does not display & (ampersand)


Skysnake
 Share

Recommended Posts

Quick search did not supply existing threads.

Maybe I am missing something.

Problem is this 

Local $DisplayText="This & that, shows that this & that does not display the ampersand correctly"

MsgBox(0,"Show &",$DisplayText)

What I get is:

This _that, shows that this _that does not display the ampersand correctly.

For Labels one cures the problem with the style $SS_NOPREFIX, but what's to do with the MsgBox?

Just a nudge in the right direction would be appreciated.

Thanks :)

 

 

Skysnake

Why is the snake in the sky?

Link to comment
Share on other sites

I believe it is a UTF related issue. 

The example above works correctly :(

But when I read text from a .txt file and display that, I get the problem as discribed. So its probably not a MsgBox issue, but rather a file read issue... I will look at this again in the morning. 

Thanks. :)

 

Skysnake

Why is the snake in the sky?

Link to comment
Share on other sites

I can't recreate that. Your ampersands get replaced with an underline?

Your code works just fine for me.

56bb5a6ecbb82_2016-02-1016_41_45-.jpg.ce

 

I've also tried this using FileRead (warning: this does an actual file write, read and delete to your temp dir, just saying).

Global $hFile = FileOpen(@TempDir & "\test1234.txt", 10)
FileWrite($hFile, "This & that, shows that this & that does not display the ampersand correctly.")
FileClose($hFile)

Sleep(2000)

$hFile = FileOpen(@TempDir & "\test1234.txt", 0)
MsgBox(0, "", FileRead($hFile))
FileClose($hFile)

FileDelete(@TempDir & "\test1234.txt")

Same result as above. There must be something else to your code which alters it that way.

Link to comment
Share on other sites

  • 2 weeks later...

Interesting...it sounds like it's creating an access key on the msgbox dialog box.  I'm not sure how that is happening or how to reproduce it.  You're not using a custom msgbox function are you?  

Link to comment
Share on other sites

Standard MSGBOX in latest AutoIt, on Win7 and Win10.

However, what I did not mention is that string is encreypted, saved to disk, then another process decrypts and displays the text.  It is this second display that creates the problem...

Skysnake

Why is the snake in the sky?

Link to comment
Share on other sites

It's probably not the message box that's the problem then, and has nothing to do with the error you're experiencing.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

And you are positive that the second script is using the standard MsgBox?  I don't mean to berate the point I am seriously struggling to reproduce the issue.  Can you post some code that does reproduce the issue?

Link to comment
Share on other sites

Its a set of encrypt / decrypt scripts that are basically mirrors. used for sending secure communication. deliver encrypted text file to recipient, opens it and sees the decoded content --- I actually started with the encrypter, then copied to the decrypt script and made minimal changes.

Its at the office.  I will sanitize and provide a copy. Thank you for your interest.

Skysnake

Why is the snake in the sky?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...