From e2819e7dc4ab8e88e4f97c0a5432adafc1c81a84 Mon Sep 17 00:00:00 2001 From: Regen Van Walbeek Date: Tue, 17 Dec 2024 12:44:53 -0600 Subject: [PATCH] Fallback to utf8 --- lib/src/http/utils.dart | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/src/http/utils.dart b/lib/src/http/utils.dart index 0151daf0..8b1abb2a 100644 --- a/lib/src/http/utils.dart +++ b/lib/src/http/utils.dart @@ -195,6 +195,7 @@ MediaType parseContentTypeFromHeaders(Map headers) { Encoding? parseEncodingFromContentType(MediaType? contentType, {Encoding? fallback}) { if (contentType == null) return fallback; + if (contentType.type == 'application' && contentType.subtype == 'json') return utf8; if (contentType.parameters['charset'] == null) return fallback; final encoding = Encoding.getByName(contentType.parameters['charset']); return encoding ?? fallback;