AdeptLanguage / Adept

The Adept Programming Language
GNU General Public License v3.0
120 stars 8 forks source link

Support for Unicode characters #324

Open ghost opened 6 months ago

ghost commented 6 months ago

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.

IsaacShelton commented 6 months ago

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
}