From 1ab21574bec8ff2cb9f5a404867e6f26127651e9 Mon Sep 17 00:00:00 2001 From: "daniele.teti" Date: Mon, 18 Nov 2013 10:51:59 +0000 Subject: [PATCH] --- sources/MVCFramework.pas | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/sources/MVCFramework.pas b/sources/MVCFramework.pas index c9a335a9..0a68cc0f 100644 --- a/sources/MVCFramework.pas +++ b/sources/MVCFramework.pas @@ -1142,15 +1142,18 @@ var c: String; begin inherited Create; - c := AWebRequest.GetFieldByName('content-type'); - CT := c.Split([';']); - FContentType := trim(CT[0]); - FContentEncoding := 'UTF-8'; // default encoding - if Length(CT) > 1 then + c := AWebRequest.GetFieldByName('Content-Type'); + if not c.IsEmpty then begin - if CT[1].trim.StartsWith('charset', true) then + CT := c.Split([';']); + FContentType := trim(CT[0]); + FContentEncoding := 'UTF-8'; // default encoding + if Length(CT) > 1 then begin - FContentEncoding := CT[1].trim.Split(['='])[1].trim; + if CT[1].trim.StartsWith('charset', true) then + begin + FContentEncoding := CT[1].trim.Split(['='])[1].trim; + end; end; end; end;