Hacker News new | ask | show | jobs
by riperoni 812 days ago
I like this a lot, thank you. Have to try it out in a project.

Is the default encoding when handling files UTF8 OR UTF8-BOM? Is both supported?

Another question: in the readme you have this example

`var joined = U8String.Join(',', boolean.Runes); // "T,r,u,e"`

Why is " T" of true in uppercase?

1 comments

That's what bool.ToString() defaults to which I'm matching. As for the file API, it's a bit unfinished as I'm re-consolidating logic into U8File (OpenRead and ReadLines work acceptably, U8File.Read works too - U8Reader is in a more polished state), but the intention for the files is to detect and strip BOMs (it already does that in most[0] places[1]).

There is way more heavy lifting that the library does on the "data goes in" side of things because "data goes out" story in .NET is already in a good shape with everything accepting ReadOnlySpan<byte> and ReadOnlyMemory<byte> - zero-allocation interpolated UTF-8 output into streams, sockets, etc. is achieved through extension methods and should you want to write UTF-8 BOM, you can simply do so beforehand working with the corresponding API directly.

However, if you have a particular use case in mind that you're interested in or have trouble with - do let me know as I'd love to have more user feedback!

[0] https://github.com/U8String/U8String/blob/main/Sources/U8Str...

[1] https://github.com/U8String/U8String/blob/main/Sources/U8Str...