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

Unicode conversion helpers for Str #7390

Open
smores56 opened this issue Dec 19, 2024 · 1 comment
Open

Unicode conversion helpers for Str #7390

smores56 opened this issue Dec 19, 2024 · 1 comment
Assignees
Labels
dev backend Specific to the dev backends good first issue Good for newcomers roc_std The roc stdlib used by hosts

Comments

@smores56
Copy link
Collaborator

from Zulip thread

We currently have a few utility functions for conversion from bytes to UTF-8 strings and back, which just got slightly updated in this PR. As a means to properly support differently encoded command line arguments across different operating systems (needed for roc-lang/basic-cli#289), we want to provide conversion functions from List U8/List U16/List U32 to Str. Here are the planned signatures:

Str.from_utf8 : List U8 -> Result Str [BadUtf8 { err : InvalidUtf8, index : U64 }]
Str.from_utf8_lossy : List U8 -> Str
Str.from_utf16 : List U16 -> Result Str [BadUtf16 { err : InvalidUtf16, index : U64 }]
Str.from_utf16_lossy : List U16 -> Str
Str.from_utf32 : List U32 -> Result Str [BadUtf32 { err : InvalidUtf32, index : U64 }]
Str.from_utf32_lossy : List U32 -> Str

The *_lossy variants should replace invalid codepoints with the Unicode replacement character, "\uFFFD".

@smores56 smores56 added good first issue Good for newcomers dev backend Specific to the dev backends roc_std The roc stdlib used by hosts labels Dec 19, 2024
@shua
Copy link
Contributor

shua commented Jan 7, 2025

I'm working on this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dev backend Specific to the dev backends good first issue Good for newcomers roc_std The roc stdlib used by hosts
Projects
None yet
Development

No branches or pull requests

2 participants