Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #1453: Fix CsvProvider encoding provider registration #1503

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/FSharp.Data.DesignTime/Csv/CsvProvider.fs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
open ProviderImplementation.QuotationBuilder
open FSharp.Data.Runtime.StructuralInference
open System.Net
open System.Text

// --------------------------------------------------------------------------------------

Expand Down Expand Up @@ -105,7 +106,11 @@
else
value

CsvFile.Parse(value, separators, quote, hasHeaders, ignoreErrors, skipRows)
// Register CodePagesEncodingProvider before getting encoding
let provider = CodePagesEncodingProvider.Instance
Encoding.RegisterProvider provider
let encoding = TextRuntime.GetEncoding encodingStr

Check failure on line 112 in src/FSharp.Data.DesignTime/Csv/CsvProvider.fs

View workflow job for this annotation

GitHub Actions / build-ubuntu

The type 'TextRuntime' does not define the field, constructor or member 'GetEncoding'.

Check failure on line 112 in src/FSharp.Data.DesignTime/Csv/CsvProvider.fs

View workflow job for this annotation

GitHub Actions / build-windows

The type 'TextRuntime' does not define the field, constructor or member 'GetEncoding'.
CsvFile.Parse(value, separators, quote, hasHeaders, ignoreErrors, skipRows, encoding)

let separators = sampleCsv.Separators

Expand Down Expand Up @@ -135,7 +140,7 @@
let paramType = typedefof<seq<_>>.MakeGenericType (rowType)

let headers =
match sampleCsv.Headers with

Check warning on line 143 in src/FSharp.Data.DesignTime/Csv/CsvProvider.fs

View workflow job for this annotation

GitHub Actions / build-ubuntu

Incomplete pattern matches on this expression.

Check warning on line 143 in src/FSharp.Data.DesignTime/Csv/CsvProvider.fs

View workflow job for this annotation

GitHub Actions / build-windows

Incomplete pattern matches on this expression.
| None -> <@@ None: string[] option @@>
| Some headers ->
Expr.NewArray(
Expand Down
Loading