According to Xojo docs “Strings have a UTF-8 Encoding by default”
But when I create a string in Xojo 2023R4 (Windows), the default encoding is US-ASCII. Example:
Dim s as string
dim enc as textencoding = s.encoding
How do I make the default encoding UTF-8, so that I don’t have to DefineEncoding for every string?
(Yes, “Read the Xojo documentation” - but where?)
Tim_Hare
(Tim Hare)
2
ascii IS utf-8. Put something in the string and then check it. Eg.,
Dim s as string = “abc”
dim enc as textencoding = s.encoding
Try creating a string with accented characters in it and see what the encoding is.
In documentation, type Strings and read.
There may be far other entries… like Encoding, etc.
Look at the See also entry at this page bottom…
Arnaud_N
(Arnaud N)
5
IIRC, empty strings don’t return the same encoding as would a non-empty one do.
Thanks, Tim, Eric and folks.
Yes, the default becomes UTF-8. My problem was that some strings are UTF-16. After discovering that, everything is explained.