1
0
mirror of https://github.com/flutter/samples.git synced 2025-11-08 13:58:47 +00:00

Force utf8-decoding of Unsplash reponse (#586 & #590) (#1075)

This commit is contained in:
Fitz
2022-04-12 18:07:32 -07:00
committed by GitHub
parent 0e3d256905
commit 322f0628e6
2 changed files with 8 additions and 2 deletions

View File

@@ -73,7 +73,10 @@ class Unsplash {
}
return SearchPhotosResponse.fromJson(
response.body,
// Per Response#body, if the Content-Type header is unknown, bodyBytes
// is interpreted as latin1. Unsplash returns utf8, but with no encoding
// specified in the Content-Type, so we must do it ourselves.
utf8.decode(response.bodyBytes),
);
}

View File

@@ -73,7 +73,10 @@ class Unsplash {
}
return SearchPhotosResponse.fromJson(
response.body,
// Per Response#body, if the Content-Type header is unknown, bodyBytes
// is interpreted as latin1. Unsplash returns utf8, but with no encoding
// specified in the Content-Type, so we must do it ourselves.
utf8.decode(response.bodyBytes),
);
}