Skip to content

Text for string(bytes) is confusing #517

@lrhn

Description

@lrhn

It states:

string(bytes) -> string converts a byte sequence to a UTF-8 string, errors for invalid code points

It probably decodes bytes from UTF-8 into a string. The result is just a string, not a "UTF-8 string", which is not a term mentioned anywhere else.

In another place, under "Ordering", it's stated that:

Strings and bytes obey lexicographic ordering of the byte values. Because strings are encoded in UTF-8, strings consequently also obey lexicographic ordering of their Unicode code points.

That's the only place representation of strings is mentioned. There is no specification of how the sequence of code points of a string must be represented. (Using UTF-8 is one way. Using an array of Uint32 would also satisfy the specification.)
It's likely true for text stored in byte literals, though.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions