swift-nio icon indicating copy to clipboard operation
swift-nio copied to clipboard

docs: `String(buffer:)` needs to mention that it will always succeed

Open weissi opened this issue 5 months ago • 1 comments

https://github.com/apple/swift-nio/blob/154706efd36d8d8a7d030eea9bcbeca56a947c62/Sources/NIOCore/ByteBuffer-conversions.swift#L36

Fails to mention that it will always succeed and adds a Unicode replacement char if non-valid UTF8.

It should also link an API that does validate UTF8

weissi avatar Nov 17 '25 18:11 weissi

Thanks for highlighting this, it looks like we should do this. I see that the underlying readString method which is used does have some related docs https://github.com/apple/swift-nio/blob/6e02c7a2467cf22526ac54521d4230d8c5890e62/Sources/NIOCore/ByteBuffer-aux.swift#L290 .

rnro avatar Nov 18 '25 11:11 rnro