Adept icon indicating copy to clipboard operation
Adept copied to clipboard

Support for Unicode characters

Open ghost opened this issue 1 year ago • 1 comments

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.

ghost avatar Feb 25 '24 05:02 ghost

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
}

IsaacShelton avatar Feb 26 '24 19:02 IsaacShelton