Hello @Devon Nullman ,
I did try to manually insert a soft hyphen and display it in both controls, and I observed the same behavior.
It seems like the soft hypen character is being introduced into your strings somewhere outside of your hash function.
For example, if somewhere in your code you have something like:
result = "Original Data Hash = " & CreateSHA512(bytes)
And that string literal "Original Data Hash = " was copied from Word or another formatted source, it would contain the hidden 0xAD characters.
Also, about why you're seeing different behavior in different controls, you should check this document about complex script processing, but in summary:
- RichEdit Control: Follows proper Unicode rendering rules and hides soft hyphens. They're invisible unless a line break occurs at that position, which is the correct behavior according to the Unicode specification.
- Standard TextBox (Edit Control): Has basic Unicode support and attempts to render soft hyphens as visible characters, which is why you're seeing them as dashes.
So ensure that all your string literals are clean and free of hidden formatting characters. You can do this by retyping them manually or using a plain text editor to strip out any unwanted characters.