Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Unicode characters #324

Open
ghost opened this issue Feb 25, 2024 · 1 comment
Open

Support for Unicode characters #324

ghost opened this issue Feb 25, 2024 · 1 comment

Comments

@ghost
Copy link

ghost commented Feb 25, 2024

Please note that this issue is different from #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
Copy link
Collaborator

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
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant