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

Figure out how to handle strings at the API boundary #5

Open
sffc opened this issue Nov 14, 2019 · 1 comment
Open

Figure out how to handle strings at the API boundary #5

sffc opened this issue Nov 14, 2019 · 1 comment
Labels
discuss before start The issues isn't quite ready to be fixed, there are open questions to be discussed enhancement New feature or request help wanted Extra attention is needed

Comments

@sffc
Copy link

sffc commented Nov 14, 2019

Nothing wrong here from a functionality point of view, but it raises questions about what is the best way to represent strings when interfacing with ICU. Many ICU APIs want UTF-16 strings but also accept UTF-8 strings. I've been toying with the idea of making a Rust version of UnicodeString that you can toggle between UTF-8 and UTF-16 at compile time. For now, I think the safest thing is for users to keep their strings in Rust-standard UTF-8, and only do the UTF-16 conversion at the API boundary. Even if you have to round-trip a few times between 8 and 16, I strongly suspect that this won't be a performance bottleneck.

@filmil
Copy link
Member

filmil commented Nov 14, 2019

Agreed. Especially for one-off calls, that e.g. do not appear in tight loops, it is probably just fine to take &str.

The value of UChar is in being readily available for interfacing with other ICU wrapped functionality.

@sffc sffc changed the title Feedback on rust_icu_ustring Figure out how to handle strings at the API boundary Nov 16, 2019
@filmil filmil added the enhancement New feature or request label May 8, 2020
@filmil filmil added the help wanted Extra attention is needed label Aug 27, 2020
@filmil filmil added the discuss before start The issues isn't quite ready to be fixed, there are open questions to be discussed label Oct 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discuss before start The issues isn't quite ready to be fixed, there are open questions to be discussed enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants