Skip to content

Commit

Permalink
Latin1 default to UTF8 default
Browse files Browse the repository at this point in the history
  • Loading branch information
haf committed Jun 27, 2018
1 parent 52bb2d4 commit 6fa93c8
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 19 deletions.
8 changes: 4 additions & 4 deletions HttpFs.IntegrationTests/AssemblyInfo.fs
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ open System.Reflection
[<assembly: AssemblyProductAttribute("HttpFs.IntegrationTests")>]
[<assembly: AssemblyCopyrightAttribute("Copyright © 2018")>]
[<assembly: AssemblyDescriptionAttribute("A simple, functional HTTP client library for F#")>]
[<assembly: AssemblyVersionAttribute("5.2.1")>]
[<assembly: AssemblyFileVersionAttribute("5.2.1")>]
[<assembly: AssemblyVersionAttribute("5.3.0")>]
[<assembly: AssemblyFileVersionAttribute("5.3.0")>]
do ()

module internal AssemblyVersionInformation =
let [<Literal>] AssemblyTitle = "HttpFs.IntegrationTests"
let [<Literal>] AssemblyProduct = "HttpFs.IntegrationTests"
let [<Literal>] AssemblyCopyright = "Copyright © 2018"
let [<Literal>] AssemblyDescription = "A simple, functional HTTP client library for F#"
let [<Literal>] AssemblyVersion = "5.2.1"
let [<Literal>] AssemblyFileVersion = "5.2.1"
let [<Literal>] AssemblyVersion = "5.3.0"
let [<Literal>] AssemblyFileVersion = "5.3.0"
6 changes: 3 additions & 3 deletions HttpFs.IntegrationTests/HttpServer.fs
Original file line number Diff line number Diff line change
Expand Up @@ -52,19 +52,19 @@ let app =
Filters.path "/MoonLanguageTextPlainNoEncoding"
>=> Writers.setHeader "Content-Type" "text/plain"
>=> warbler (fun _ ->
Encoding.GetEncoding("windows-1251").GetBytes("яЏ§§їДЙ")
Encoding.UTF8.GetBytes("яЏ§§їДЙ")
|> Successful.ok)

Filters.path "/MoonLanguageApplicationXmlNoEncoding"
>=> Writers.setHeader "Content-Type" "application/xml"
>=> warbler (fun _ ->
Encoding.GetEncoding("windows-1251").GetBytes("яЏ§§їДЙ")
Encoding.UTF8.GetBytes("яЏ§§їДЙ")
|> Successful.ok)

Filters.path "/MoonLanguageInvalidEncoding"
>=> Writers.setHeader "Content-Type" "text/plain; charset=Ninky-Nonk"
>=> warbler (fun _ ->
Encoding.GetEncoding("windows-1251").GetBytes("яЏ§§їДЙ")
Encoding.UTF8.GetBytes("яЏ§§їДЙ")
|> Successful.ok)

Filters.path "/utf8"
Expand Down
4 changes: 2 additions & 2 deletions HttpFs.IntegrationTests/Tests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -294,8 +294,8 @@ let tests =
Expect.equal responseBodyString "яЏ§§їДЙ" "body should be equal"
}

testCaseAsync "response charset IS NOT SPECIFIED, NO Content-Type header, body read by default as Latin 1" <| async {
let expected = "ÿ§§¿ÄÉ" // "яЏ§§їДЙ" (as encoded with windows-1251) decoded with ISO-8859-1 (Latin 1)
testCaseAsync "response charset IS NOT SPECIFIED, NO Content-Type header, body read by default as UTF8" <| async {
let expected = "яЏ§§їДЙ"

let! response =
Request.create Get (uriFor "/MoonLanguageTextPlainNoEncoding")
Expand Down
8 changes: 4 additions & 4 deletions HttpFs.UnitTests/AssemblyInfo.fs
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ open System.Reflection
[<assembly: AssemblyProductAttribute("HttpFs.UnitTests")>]
[<assembly: AssemblyCopyrightAttribute("Copyright © 2018")>]
[<assembly: AssemblyDescriptionAttribute("A simple, functional HTTP client library for F#")>]
[<assembly: AssemblyVersionAttribute("5.2.1")>]
[<assembly: AssemblyFileVersionAttribute("5.2.1")>]
[<assembly: AssemblyVersionAttribute("5.3.0")>]
[<assembly: AssemblyFileVersionAttribute("5.3.0")>]
do ()

module internal AssemblyVersionInformation =
let [<Literal>] AssemblyTitle = "HttpFs.UnitTests"
let [<Literal>] AssemblyProduct = "HttpFs.UnitTests"
let [<Literal>] AssemblyCopyright = "Copyright © 2018"
let [<Literal>] AssemblyDescription = "A simple, functional HTTP client library for F#"
let [<Literal>] AssemblyVersion = "5.2.1"
let [<Literal>] AssemblyFileVersion = "5.2.1"
let [<Literal>] AssemblyVersion = "5.3.0"
let [<Literal>] AssemblyFileVersion = "5.3.0"
8 changes: 4 additions & 4 deletions HttpFs/AssemblyInfo.fs
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ open System.Reflection
[<assembly: AssemblyProductAttribute("HttpFs")>]
[<assembly: AssemblyCopyrightAttribute("Copyright © 2018")>]
[<assembly: AssemblyDescriptionAttribute("A simple, functional HTTP client library for F#")>]
[<assembly: AssemblyVersionAttribute("5.2.1")>]
[<assembly: AssemblyFileVersionAttribute("5.2.1")>]
[<assembly: AssemblyVersionAttribute("5.3.0")>]
[<assembly: AssemblyFileVersionAttribute("5.3.0")>]
do ()

module internal AssemblyVersionInformation =
let [<Literal>] AssemblyTitle = "HttpFs"
let [<Literal>] AssemblyProduct = "HttpFs"
let [<Literal>] AssemblyCopyright = "Copyright © 2018"
let [<Literal>] AssemblyDescription = "A simple, functional HTTP client library for F#"
let [<Literal>] AssemblyVersion = "5.2.1"
let [<Literal>] AssemblyFileVersion = "5.2.1"
let [<Literal>] AssemblyVersion = "5.3.0"
let [<Literal>] AssemblyFileVersion = "5.3.0"
2 changes: 1 addition & 1 deletion HttpFs/HttpFs.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1003,7 +1003,7 @@ module Client =
| None ->
match response.characterSet with
| None ->
ISOLatin1 // TODO: change to UTF-8
Encoding.UTF8
| Some responseCharset ->
try Encoding.GetEncoding(mapEncoding responseCharset)
with _ -> Encoding.UTF8
Expand Down
2 changes: 1 addition & 1 deletion HttpFs/HttpFs.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<AssemblyName>HttpFs</AssemblyName>
<PackageId>Http.fs</PackageId>
<Version>5.2.1</Version>
<Version>5.3.0</Version>
<TargetFrameworks>netstandard2.0;net471</TargetFrameworks>
</PropertyGroup>
<ItemGroup>
Expand Down
3 changes: 3 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#### 5.3.0 — 2018-06-27
* Default non-specified charsets to UTF8 rather than Latin 1.

#### 5.2.1 — 2018-06-07
* Allow adding Authorization header without HttpClient validating it.

Expand Down

0 comments on commit 6fa93c8

Please sign in to comment.