diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index bb03368b4..91f8264c8 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -1,5 +1,9 @@ # Release Notes +## 9.0.0 + +- Change HTTP response default encoding from ISO-8859-1 to UTF-8 to match `System.Net.Http.HttpClient` behaviour (closes #1251) + ## 8.1.0 - Mar 08 2026 - Add schema.org microdata support to `HtmlProvider`: when an HTML document contains elements with `itemscope`/`itemtype`/`itemprop` attributes, the provider now generates a typed `Schemas` container (e.g. `doc.Schemas.Person`) with one strongly-typed property per `itemprop` name discovered in the sample (closes #611) diff --git a/src/FSharp.Data.DesignTime/Csv/CsvProvider.fs b/src/FSharp.Data.DesignTime/Csv/CsvProvider.fs index b78c65525..e464ffe4a 100644 --- a/src/FSharp.Data.DesignTime/Csv/CsvProvider.fs +++ b/src/FSharp.Data.DesignTime/Csv/CsvProvider.fs @@ -273,7 +273,7 @@ type public CsvProvider(cfg: TypeProviderConfig) as this = + """. Whether the rows should be caches so they can be iterated multiple times. Defaults to true. Disable for large datasets. The culture used for parsing numbers and dates. Defaults to the invariant culture. - The encoding used to read the sample. You can specify either the character set name or the codepage number. Defaults to UTF8 for files, and to ISO-8859-1 the for HTTP requests, unless charset is specified in the Content-Type response header. + The encoding used to read the sample. You can specify either the character set name or the codepage number. Defaults to UTF8 for files, and for HTTP requests when no charset is specified in the Content-Type response header. A directory that is used when resolving relative file references (at design time and in hosted execution). When specified, the type provider first attempts to load the sample from the specified resource (e.g. 'MyCompany.MyAssembly, resource_name.csv'). This is useful when exposing types generated by the type provider. diff --git a/src/FSharp.Data.DesignTime/Html/HtmlProvider.fs b/src/FSharp.Data.DesignTime/Html/HtmlProvider.fs index bedb1a34b..4c59362d8 100644 --- a/src/FSharp.Data.DesignTime/Html/HtmlProvider.fs +++ b/src/FSharp.Data.DesignTime/Html/HtmlProvider.fs @@ -111,7 +111,7 @@ type public HtmlProvider(cfg: TypeProviderConfig) as this = + String.Join(",", TextConversions.DefaultMissingValues) + """. The culture used for parsing numbers and dates. Defaults to the invariant culture. - The encoding used to read the sample. You can specify either the character set name or the codepage number. Defaults to UTF8 for files, and to ISO-8859-1 the for HTTP requests, unless charset is specified in the Content-Type response header. + The encoding used to read the sample. You can specify either the character set name or the codepage number. Defaults to UTF8 for files, and for HTTP requests when no charset is specified in the Content-Type response header. A directory that is used when resolving relative file references (at design time and in hosted execution). When specified, the type provider first attempts to load the sample from the specified resource (e.g. 'MyCompany.MyAssembly, resource_name.html'). This is useful when exposing types generated by the type provider. diff --git a/src/FSharp.Data.DesignTime/Json/JsonProvider.fs b/src/FSharp.Data.DesignTime/Json/JsonProvider.fs index 5c46790b2..663afa676 100644 --- a/src/FSharp.Data.DesignTime/Json/JsonProvider.fs +++ b/src/FSharp.Data.DesignTime/Json/JsonProvider.fs @@ -198,7 +198,7 @@ type public JsonProvider(cfg: TypeProviderConfig) as this = If true, sample should be a list of individual samples for the inference. The name to be used to the root type. Defaults to `Root`. The culture used for parsing numbers and dates. Defaults to the invariant culture. - The encoding used to read the sample. You can specify either the character set name or the codepage number. Defaults to UTF8 for files, and to ISO-8859-1 the for HTTP requests, unless `charset` is specified in the `Content-Type` response header. + The encoding used to read the sample. You can specify either the character set name or the codepage number. Defaults to UTF8 for files, and for HTTP requests when no `charset` is specified in the `Content-Type` response header. A directory that is used when resolving relative file references (at design time and in hosted execution). When specified, the type provider first attempts to load the sample from the specified resource (e.g. 'MyCompany.MyAssembly, resource_name.json'). This is useful when exposing types generated by the type provider. diff --git a/src/FSharp.Data.DesignTime/Xml/XmlProvider.fs b/src/FSharp.Data.DesignTime/Xml/XmlProvider.fs index 58d65196b..fb2891afa 100644 --- a/src/FSharp.Data.DesignTime/Xml/XmlProvider.fs +++ b/src/FSharp.Data.DesignTime/Xml/XmlProvider.fs @@ -238,7 +238,7 @@ type public XmlProvider(cfg: TypeProviderConfig) as this = If true, the children of the root in the sample document represent individual samples for the inference. If true, the inference unifies all XML elements with the same name. The culture used for parsing numbers and dates. Defaults to the invariant culture. - The encoding used to read the sample. You can specify either the character set name or the codepage number. Defaults to UTF8 for files, and to ISO-8859-1 the for HTTP requests, unless charset is specified in the Content-Type response header. + The encoding used to read the sample. You can specify either the character set name or the codepage number. Defaults to UTF8 for files, and for HTTP requests when no charset is specified in the Content-Type response header. A directory that is used when resolving relative file references (at design time and in hosted execution). When specified, the type provider first attempts to load the sample from the specified resource (e.g. 'MyCompany.MyAssembly, resource_name.xml'). This is useful when exposing types generated by the type provider. diff --git a/src/FSharp.Data.Http/Http.fs b/src/FSharp.Data.Http/Http.fs index 8cc2f09c0..10f5a2c4b 100644 --- a/src/FSharp.Data.Http/Http.fs +++ b/src/FSharp.Data.Http/Http.fs @@ -1376,8 +1376,8 @@ module HttpEncodings = /// ISO-8859-1 let PostDefaultEncoding = Encoding.GetEncoding("ISO-8859-1") // http://stackoverflow.com/questions/708915/detecting-the-character-encoding-of-an-http-post-request/708942#708942 - /// ISO-8859-1 - let ResponseDefaultEncoding = Encoding.GetEncoding("ISO-8859-1") // http://www.ietf.org/rfc/rfc2616.txt + /// UTF-8 (matches System.Net.Http.HttpClient default behaviour; RFC 2616 specifies ISO-8859-1 but modern servers and browsers default to UTF-8) + let ResponseDefaultEncoding = Encoding.UTF8 let internal getEncoding (encodingStr: string) = match Int32.TryParse(encodingStr, NumberStyles.Integer, CultureInfo.InvariantCulture) with diff --git a/tests/FSharp.Data.Core.Tests/HttpEncodings.fs b/tests/FSharp.Data.Core.Tests/HttpEncodings.fs index 5aaba8721..b2a3ee869 100644 --- a/tests/FSharp.Data.Core.Tests/HttpEncodings.fs +++ b/tests/FSharp.Data.Core.Tests/HttpEncodings.fs @@ -10,8 +10,8 @@ let ``HttpEncodings.PostDefaultEncoding returns ISO-8859-1`` () = HttpEncodings.PostDefaultEncoding.WebName |> should equal "iso-8859-1" [] -let ``HttpEncodings.ResponseDefaultEncoding returns ISO-8859-1`` () = - HttpEncodings.ResponseDefaultEncoding.WebName |> should equal "iso-8859-1" +let ``HttpEncodings.ResponseDefaultEncoding returns UTF-8`` () = + HttpEncodings.ResponseDefaultEncoding.WebName |> should equal "utf-8" [] let ``HttpEncodings.getEncoding with valid encoding name works`` () =