There’s something strange about the text encoding for font names coming out of StyleRun for Carbon:
TextArea1.Text = "Test"
TextArea1.SelStart = 0
TextArea1.SelLength = 4
TextArea1.SelTextFont = "Arial"
dim st as StyleRun = TextArea1.StyledText.StyleRun(0)
dim s as string = st.Font
dim enc as TextEncoding = s.Encoding
On my system, running Xojo 2014 R1.1, I get the following bytes back for the font name:
41 00 72 00 69 00 61 00 6C 00
This looks like UTF-16. Encoding returns a TextEncoding with the following values:
base: 63452
code -1073743908
format: 15
internetName: “” (empty string)
variant: 1023
Converting to UTF-8 doesn’t work:
dim s1 as string = ConvertEncoding(s, Encodings.UTF8)
s1 is set to the empty string (i.e. the conversion silently fails).
Has anyone else run into the issue?