I did more testing, and the plot thickens:
I have a simple app which runs this code:
Dim s as string = "Audio and Video © by their respective owners"
s = s.DefineEncoding(nil)
dim r as string
dim s2 as string = s.left(17)
dim n2 as integer = lenB(s2)
r = "Encoding: nil Left(17).LenB = " + str(n2) + " '" + s2 + "'"
label1.Text = r
I then test the app on Engligsh and Korean versions of macOS.
- Built with Xojo 2019R1.1, on Korean systems we see Left(17).LenB = 18.
- Built with REALstudio 2011R3, on Korean systems we see Left(17).LenB = 17.
- On English systems, 2011R3 and 2019R1 always return Left(17).LenB = 17
So, somewhere between 2011 and 2019 versions of Xojo the behvior changed. The older behavior (in which nil encoding was treated as a bag of bytes regardless of OS settings) was preferable. The newer behavior is more dangerous.
Was this change intentional?