Skip to content

Lacking sections about string and unicode #298

@Jiehong

Description

@Jiehong

Hello,

First of all, thank you for this guide!

I'm new to Zig, and I cannot see a section in the guide about strings and unicode.

What I understood was that ascii is handled as []u8, but unicode quickly became a question mark as soon as I wrote in French and Chinese.

That's where things are unclear and not talked about in the doc.

For example, I was surprised by this not printing the right characters:

    const data = "abc好";
    for (data) |character| {
        std.debug.print("Here is a '{u}'\n", .{character});
    }

Checking online, there is an old lib lacking a maintainer: https://codeberg.org/dude_the_builder/zigstr

So, perhaps it would be nice to have a sections about strings in general and how to handle unicode by default?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions