Replace unusual characters

uiautomation

#1

I have a text string that when added into a Message Box appears with strange characters.

The text is as follows: “Account: ‘180101’,’182401’”

The result is as follows: Account: �180101�,�182401�

I have used Text.Replace(“�”,"’") and it is a bit of a hit and miss. In similar texts it works and in some cases it doesn’t. It is driving me a bit crazy.

Is it possible to convert characters into value codes, to identify what character I need to replace, and replace it using the Text.Replace function?

Thanks


#2

text.Replace("\u2018", “’”).Replace("\u2019", “’”)

‘ (U+2018) LEFT SINGLE QUOTATION MARK
’ (U+2019) RIGHT SINGLE QUOTATION MARK
“ (U+201C) LEFT DOUBLE QUOTATION MARK
” (U+201D) RIGHT DOUBLE QUOTATION MARK


#3

Thanks, that is what I was looking for.
Great!!!