Skip to content

Commit

Permalink
FIX some encoding problems introduced by VSCode replace-in-files >:|
Browse files Browse the repository at this point in the history
  • Loading branch information
danieleteti committed Jan 3, 2024
1 parent f23dd2f commit a2e19a7
Show file tree
Hide file tree
Showing 12 changed files with 114 additions and 112 deletions.
2 changes: 1 addition & 1 deletion contrib/MVCFramework.View.Renderers.Sempare.pas
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//
// Delphi MVC Framework
//
// Copyright (c) 2010-2023 Daniele Teti and the DMVCFramework Team
// Copyright (c) 2010-2024 Daniele Teti and the DMVCFramework Team
//
// https://github.com/danieleteti/delphimvcframework
//
Expand Down
6 changes: 3 additions & 3 deletions samples/commons/RandomUtilsU.pas
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//
// Delphi MVC Framework
//
// Copyright (c) 2010-2024 Daniele Teti and the DMVCFramework Team
// Copyright (c) 2010-2023 Daniele Teti and the DMVCFramework Team
//
// https://github.com/danieleteti/delphimvcframework
//
Expand Down Expand Up @@ -36,7 +36,7 @@ interface
'Tim',
'Joseph',
'David',
'Ale�',
'Aleš',
'Thomas'
);

Expand All @@ -48,7 +48,7 @@ interface
'Jones',
'Miller',
'Davis',
'M�ller',
'Müller',
'Martinez',
'Anderson'
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//
// Delphi MVC Framework
//
// Copyright (c) 2010-2024 Daniele Teti and the DMVCFramework Team
// Copyright (c) 2010-2023 Daniele Teti and the DMVCFramework Team
//
// https://github.com/danieleteti/delphimvcframework
//
Expand Down Expand Up @@ -487,7 +487,7 @@ procedure TMainForm.btnSearchClick(Sender: TObject);
for I := 0 to lJSON.Count - 1 do
begin
lJObj := lJSON[I].ObjectValue;
ListBox1.Items.Add(Format('%6s: %-34s %5.2f', [lJObj.S['codice'], lJObj.S['descrizione'], lJObj.F['prezzo']]));
ListBox1.Items.Add(Format('%6s: %-34s € %5.2f', [lJObj.S['codice'], lJObj.S['descrizione'], lJObj.F['prezzo']]));
end;
end);
end;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//
// Delphi MVC Framework
//
// Copyright (c) 2010-2024 Daniele Teti and the DMVCFramework Team
// Copyright (c) 2010-2023 Daniele Teti and the DMVCFramework Team
//
// https://github.com/danieleteti/delphimvcframework
//
Expand Down Expand Up @@ -456,7 +456,7 @@ procedure TMainForm.btnSearchClick(Sender: TObject);
for I := 0 to lJSON.Count - 1 do
begin
lJObj := lJSON[I].ObjectValue;
ListBox1.Items.Add(Format('%6s: %-34s %5.2f', [lJObj.S['codice'], lJObj.S['descrizione'], lJObj.F['prezzo']]));
ListBox1.Items.Add(Format('%6s: %-34s € %5.2f', [lJObj.S['codice'], lJObj.S['descrizione'], lJObj.F['prezzo']]));
end;
// lbPerson.Items.Add('First Name:'.PadRight(15) + lJSON.S['firstname']);
// lbPerson.Items.Add('Last Name:'.PadRight(15) + lJSON.S['lastname']);
Expand Down
1 change: 1 addition & 0 deletions samples/serversideviews_sempare/bin/people.data
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[{"first_name":"Daniele","last_name":"Teti","age":43,"devices":[],"guid":"49E8419B66C744529D63DB292389D541"},{"first_name":"Peter","last_name":"Parker","age":23,"devices":[],"guid":"C5489969A04D4AE4B00D4FC50C8ADB5C"},{"first_name":"Bruce","last_name":"Banner","age":50,"devices":[],"guid":"B41D180F30584558B4F4A1AAF849FFA3"},{"first_name":"Sue","last_name":"Storm","age":33,"devices":[],"guid":"3F058118B8C6470D9684E127BC30A84A"},{"first_name":"Scott","last_name":"Summer","age":35,"devices":[],"guid":"3518D8C6F60E42D19C5A7250ADEADC33"},{"first_name":"Reed","last_name":"Richards","age":45,"devices":["smartphone","desktop"],"guid":"09C85C9DEB714476AADB9EB0AD689536"}]
4 changes: 2 additions & 2 deletions sources/MVCFramework.Commons.pas
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//
// https://github.com/danieleteti/delphimvcframework
//
// Collaborators on this file: Ezequiel Juliano M�ller ([email protected])
// Collaborators on this file: Ezequiel Juliano Müller ([email protected])
//
// ***************************************************************************
//
Expand Down Expand Up @@ -121,7 +121,7 @@ TMVCConstants = record
LAST_AUTHORIZATION_HEADER_VALUE = '__DMVC_LAST_AUTHORIZATION_HEADER_VALUE_';
SSE_RETRY_DEFAULT = 100;
SSE_LAST_EVENT_ID = 'Last-Event-ID';
URL_MAPPED_PARAMS_ALLOWED_CHARS = ' ������''"@\[\]\{\}\(\)\=;&#\.:!\_,%\w\d\x2D\x3A\$';
URL_MAPPED_PARAMS_ALLOWED_CHARS = ' àèéùòì''"@\[\]\{\}\(\)\=;&#\.:!\_,%\w\d\x2D\x3A\$';
OneMiB = 1048576;
OneKiB = 1024;
DEFAULT_MAX_REQUEST_SIZE = OneMiB * 5; // 5 MiB
Expand Down
1 change: 1 addition & 0 deletions sources/MVCFramework.RQL.AST2MySQL.pas
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ TRQLMySQLCompiler = class(TRQLCompiler)
function RQLLogicOperatorToSQL(const aRQLFIlter: TRQLLogicOperator): string;
protected
function RQLCustom2SQL(const aRQLCustom: TRQLCustom): string; override;
public
function GetTableNameForSQL(const TableName: string): string; override;
function GetFieldNameForSQL(const FieldName: string): string; override;
end;
Expand Down
12 changes: 6 additions & 6 deletions unittests/general/RESTClient/MVCFramework.Tests.RESTClient.pas
Original file line number Diff line number Diff line change
Expand Up @@ -189,17 +189,17 @@ procedure TTestRESTClient.TestBodyURLEncoded;
lResp := FRESTClient
// .SetBasicAuthorization('dmvc', '123')
.AddBodyFieldURLEncoded('field1', 'value1')
.AddBodyFieldURLEncoded('field2', 'Jo�o Ant�nio')
.AddBodyFieldURLEncoded('field3', 'Special characters: ��������s')
.AddBodyFieldURLEncoded('field2', 'João Antônio')
.AddBodyFieldURLEncoded('field3', 'Special characters: öüáàçãõºs')
.Post('/body-url-encoded');

Assert.AreEqual(lResp.StatusCode, 200);

lJsonResp := TJDOJsonBaseObject.Parse(lResp.Content) as TJDOJsonObject;
try
Assert.AreEqual('value1', lJsonResp.S['field1']);
Assert.AreEqual('Jo�o Ant�nio', lJsonResp.S['field2']);
Assert.AreEqual('Special characters: ��������s', lJsonResp.S['field3']);
Assert.AreEqual('João Antônio', lJsonResp.S['field2']);
Assert.AreEqual('Special characters: öüáàçãõºs', lJsonResp.S['field3']);
finally
lJsonResp.Free;
end;
Expand Down Expand Up @@ -364,7 +364,7 @@ procedure TTestRESTClient.TestPostUsers;
begin
LUser := TAppUser.Create;
LUser.Cod := I;
LUser.Name := 'Ezequiel ��������s ' + IntToStr(I);
LUser.Name := 'Ezequiel öüáàçãõºs ' + IntToStr(I);
LUser.Pass := IntToStr(I);
LUsers.Add(LUser);
end;
Expand All @@ -380,7 +380,7 @@ procedure TTestRESTClient.TestPostUsers;
begin
LUser := TAppUser.Create;
LUser.Cod := I;
LUser.Name := 'Ezequiel ��������s ' + IntToStr(I);
LUser.Name := 'Ezequiel öüáàçãõºs ' + IntToStr(I);
LUser.Pass := IntToStr(I);
LUsers.Add(LUser);
end;
Expand Down
2 changes: 1 addition & 1 deletion unittests/general/Several/BOs.pas
Original file line number Diff line number Diff line change
Expand Up @@ -763,7 +763,7 @@ function GetMyObjectWithStream: TMyStreamObject;
function GetMyObject: TMyObject;
begin
Result := TMyObject.Create;
Result.PropString := 'Some text ������';
Result.PropString := 'Some text àèéìòù';
Result.PropAnsiString := 'This is an ANSI text';
Result.PropInteger := -1234;
Result.PropUInt32 := 1234;
Expand Down
28 changes: 14 additions & 14 deletions unittests/general/Several/LiveServerTestU.pas
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,11 @@ TServerTest = class(TBaseServerTest)
[Test]
procedure TestReqWithParams;

// URL_MAPPED_PARAMS_ALLOWED_CHARS = ' ������@\[\]\{\}\(\)\=;&#\.\_\,%\w\d\x2D\x3A';
// URL_MAPPED_PARAMS_ALLOWED_CHARS = ' àèéùòì@\[\]\{\}\(\)\=;&#\.\_\,%\w\d\x2D\x3A';
[Test]
[TestCase('1', ' �,�')]
[TestCase('2', '�,�,�')]
[TestCase('3', ',@,[')]
[TestCase('1', ' à,è')]
[TestCase('2', 'é,ù,ò')]
[TestCase('3', 'ì,@,[')]
[TestCase('4', '],{,}')]
[TestCase('5', '(,),\')]
[TestCase('6', '=,;,&')]
Expand Down Expand Up @@ -1190,17 +1190,17 @@ procedure TServerTest.TestEncodingRenderJSONValue;

lJSONObj := TSystemJSON.StringAsJSONObject(res.Content);
S := lJSONObj.Get('name1').JsonValue.Value;
Assert.areEqual('j�rn', S);
Assert.areEqual('jørn', S);
lJSONObj.Free;

lJSONObj := TSystemJSON.StringAsJSONObject(res.Content);
S := lJSONObj.Get('name3').JsonValue.Value;
Assert.areEqual('������', S);
Assert.areEqual('àèéìòù', S);
lJSONObj.Free;

lJSONObj := TSystemJSON.StringAsJSONObject(res.Content);
S := lJSONObj.Get('name2').JsonValue.Value;
Assert.areEqual('to je Unicode?', S,
Assert.areEqual('Što je Unicode?', S,
'If this test fail, check http://qc.embarcadero.com/wc/qcmain.aspx?d=119779');
lJSONObj.Free;
{ WARNING!!! }
Expand Down Expand Up @@ -1618,7 +1618,7 @@ procedure TServerTest.TestGetInject10;
lResp := RESTClient.Get('/injectable10');
lJSON := StrToJSONObject(lResp.Content);
try
Assert.areEqual('this is a string', lJSON.S['ParString'], 'wrong string');
Assert.areEqual('this is a string', lJSON.S['ParString'], 'wrong string: ' + lJSON.ToJSON());
Assert.areEqual(1234, lJSON.I['ParInteger'], 'wrong ParInteger');
Assert.areEqual<Int64>(1234567890, lJSON.L['ParInt64'], 'wrong ParInt64');
Assert.areEqual('2011-11-17', lJSON.S['ParTDate'], 'wrong ParTDate');
Expand Down Expand Up @@ -2152,7 +2152,7 @@ procedure TServerTest.TestPOSTWithObjectJSONBody;
P := TPerson.Create;
try
P.FirstName := 'Daniele';
P.LastName := '������';
P.LastName := 'àòùèéì';
P.DOB := EncodeDate(1979, 1, 1);
P.Married := true;
try
Expand All @@ -2179,7 +2179,7 @@ procedure TServerTest.TestPOSTWithObjectJSONBody;
GetDefaultSerializer.DeserializeObject(r.Content, P);
// P := Mapper.JSONObjectToObject<TPerson>(r.BodyAsJsonObject);
Assert.areEqual('Daniele', P.FirstName);
Assert.areEqual('������', P.LastName);
Assert.areEqual('àòùèéì', P.LastName);
Assert.areEqual(true, P.Married);
Assert.areEqual(EncodeDate(1979, 1, 1), P.DOB);
finally
Expand All @@ -2195,7 +2195,7 @@ procedure TServerTest.TestPOSTWithoutContentType;
P := TPerson.Create;
try
P.FirstName := 'Daniele';
P.LastName := '������';
P.LastName := 'àòùèéì';
P.DOB := EncodeDate(1979, 1, 1);
P.Married := true;
try
Expand All @@ -2220,7 +2220,7 @@ procedure TServerTest.TestPOSTWithoutContentType;
GetDefaultSerializer.DeserializeObject(r.Content, P);
// P := Mapper.JSONObjectToObject<TPerson>(r.BodyAsJsonObject);
Assert.areEqual('Daniele', P.FirstName);
Assert.areEqual('������', P.LastName);
Assert.areEqual('àòùèéì', P.LastName);
Assert.areEqual(true, P.Married);
Assert.areEqual(EncodeDate(1979, 1, 1), P.DOB);
finally
Expand Down Expand Up @@ -2306,7 +2306,7 @@ procedure TServerTest.TestProducesConsumes03;
TEncoding.Convert(
TEncoding.Default,
lISO8859_1Encoding,
lISO8859_1Encoding.GetBytes('������')
lISO8859_1Encoding.GetBytes('àèéìòù')
)
);
finally
Expand All @@ -2315,7 +2315,7 @@ procedure TServerTest.TestProducesConsumes03;
res := RESTClient.Accept(TMVCMediaType.TEXT_PLAIN)
.Post('/testconsumes/textiso8859_1', lVal, BuildContentType(TMVCMediaType.TEXT_PLAIN, TMVCCharSet.ISO88591));
Assert.areEqual<Integer>(HTTP_STATUS.OK, res.StatusCode);
// Assert.AreNotEqual('������', res.Content, 'non iso8859-1 text is rendered ok whan should not');
// Assert.AreNotEqual('àèéìòù', res.Content, 'non iso8859-1 text is rendered ok whan should not');
SplitContentMediaTypeAndCharset(res.ContentType, lContentType, lContentCharset);
Assert.areEqual(lContentType, TMVCMediaType.TEXT_PLAIN);
Assert.areEqual(lContentCharset, TMVCCharSet.ISO88591);
Expand Down
Loading

0 comments on commit a2e19a7

Please sign in to comment.