When to define encodings?

Fun fact: In Xojo the encoding of the empty string is always US-ASCII, not UTF8.

[quote=103270:@Eli Ott]Generally you should use ConvertEncoding for outgoing strings and DefineEncoding for incoming data. This could be from/to databases, tcp sockets, files, etc.

I find the names of the two methods a bit misleading:

Dim aString As String = aRecordSet.IdxField(0).StringValue.DefineEncoding(Encodings.WindowANSI)

I think the term ConvertFromEncoding for DefineEncoding (and ConvertToEncoding for ConvertEncoding) would be more accurate.[/quote]
Except Define Encoding does NO conversion
It literally sets the “encoding type” on the string