dotnet / dotnet/SqlClient

UTF8 Support via GetBytes or GetFieldValue

Open
#1,208 20 comments 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
989
Forks
340
Avg merge
4d 19h
Merged PRs (30d)
72

Description

See discussion in [.Net Repo ](https://github.com/dotnet/runtime/issues/57262), specifically this [comment](https://github.com/dotnet/runtime/issues/57262#issuecomment-897485956)

### Is your feature request related to a problem? Please describe.
There is Utf8JsonWriter which allows us to write UTF8 Strings directly to the browser. If I get data from MS SQL Server which might be stored in UTF8 already, it's always converted to C# UTF16 and then back to UTF8

### Describe the solution you'd like
I'd like to be able to get the ReadOnlySpan or byte[] of the UTF8 value in order to directly use it in Utf8JsonWriter (or whatever API). It would be ok for me to just get the raw byte[] value in the encoding of the server, meaning different results for varchar, varchar collate *utf8 and nvarchar.

### Describe alternatives you've considered
Well, the alternative is to just not do it and accept the overhead produced

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.