Skip to content
This repository was archived by the owner on Feb 19, 2026. It is now read-only.
This repository was archived by the owner on Feb 19, 2026. It is now read-only.

Could be more resilient to non-utf8-encoded output #2

@dabrahams

Description

@dabrahams

Here I think it would be better to accumulate everything in Data and only attempt to decode it when you finally need a string. Then you could (optionally) try multiple encodings and fall back to encoding-repairing conversion by appending a nul character and using String.decodeCString(p, as: UTF8.self, repairingInvalidCodeUnits: true).

https://github.com/flintprocessor/Work/blob/4a7a6ff7a87bac408cfc69382b8332f53f89e046/Sources/Work/Work.swift#L92

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