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

Clarify encoding used for C strings in the API. #355

Closed
markshannon opened this issue Sep 22, 2022 · 2 comments
Closed

Clarify encoding used for C strings in the API. #355

markshannon opened this issue Sep 22, 2022 · 2 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@markshannon
Copy link

It is not clear what encoding is used for C strings in the API. Are they ASCII, latin-1, or utf-8?

Either make this clear in the docs (maybe it is, but my cursory inspection didn't find it), or better still in the API itself.
A simple typedef would suffice.

typedef const char *Utf8String;

This would also make it clearer what is text data, and what is just bytes.

In HPyBytes_FromStringAndSize(HPyContext *ctx, const char *v, HPy_ssize_t len), v is just an array of bytes,
but in HPyImport_ImportModule(HPyContext *ctx, const char *name) name is a name.
The name gives a clue, but the encoding is hidden.
HPyImport_ImportModule(HPyContext *ctx, Utf8String name) is much clearer.

@markshannon markshannon added the enhancement New feature or request label Sep 22, 2022
@timfel
Copy link
Contributor

timfel commented Oct 5, 2022

I agree, I think utf8everywhere is the right approach and we should make that clear in the name

@timfel timfel added this to the Version 0.9 milestone Nov 1, 2022
@fangerer
Copy link
Contributor

fangerer commented Dec 1, 2022

We decided in today's dev call that we will just do that.

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

No branches or pull requests

3 participants