Adept
Adept copied to clipboard
Support for Unicode characters
Please note that this issue is different from https://github.com/AdeptLanguage/Adept/issues/280.
On modern C/C++, it's already possible to declare a char/string is UTF-8, UTF-16, or UTF-32 by using of prefixes, e.g: u8"my string" (my string is encoded in UTF-8).
Adept itself already has the ub suffix to specify a C char/string.
Yes this is a problem, the current best option is probably #embed-ing it.
Adding support would probably require a significant amount of restructuring.
Which is why I plan on fixing this in Adept 3.x
Currently, the best option (although horrible) is:
import String
func main {
s String = #embed "my_utf16_file.txt"
num_characters usize = calculateUTF16Length(s.array, s.length) // need 3rd party library
}