Encoding Problems

Hi, I have stored in some ListBox cells some UTF16BE text (and in some other cells some UTF8 text but that works fine).

I need to carry out a replacement in the text string defined by 2 text fields - ‘LookFor’ and ‘ReplaceWith’

I can do all of this but the resulting string will not go back into the ListBox cell as UTF16BE, it stubbornly stays in UTF8.

This is my code:

s = DefineEncoding(Window3.ListBox1.Cell(i,1), Encodings.UTF16BE) s1 = ConvertEncoding(s,Encodings.UTF8) s2 = Replace(s1, LookFor.text, ReplaceWith.text) Window3.ListBox1.Cell(i,1) = ConvertEncoding(s2,Encodings.UTF16BE)

The last line does not do anything as the text string goes back as UTF8 and not UTF16BE.

Can anyone see where I’m going wrong here?

thanks

I’m not seeing that. If I put a UTF16 string into a listbox, I get a UTF16 string back out. Also, it’s not necessary to convert the encoding in order to do a replace.