danieleteti / delphimvcframework

DMVCFramework (for short) is a popular and powerful framework for WEB API in Delphi. Supports RESTful and JSON-RPC WEB APIs development.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

EEncodingError

atiweb opened this issue · comments

{
"classname": "EEncodingError",
"detailedmessage": "",
"apperrorcode": 0,
"items": [

],
"statuscode": 500,
"reasonstring": "error",
"message": "No mapping for the Unicode character exists in the target multi-byte code page",
"data": null
}

Using ** DMVCFramework Server ** build 3.2.2 (nitrogen)
Delphi 10.4 Update1

The error arraise when trying to read string fields containing portuguese characters Ç

To reproduce just try to process that kind of data using TMVCActiveRecord

The error raise in MVCFramework.Serializer.Commons.pas
line 1132: lSStream := TStringStream.Create('', TEncoding.Unicode);
That line was changed to lSStream := TStringStream.Create('', TEncoding.ASCII);

Update:
In line 1132 remove entirely the encoding:
lSStream := TStringStream.Create('');

That assign the TMBCSEncoding class as the default encoding. More in:
http://docwiki.embarcadero.com/Libraries/Sydney/en/System.SysUtils.TMBCSEncoding
It appear to be a better solution

and the error disappear and now all working normally, but I dont know if that will have some other impact more ahead in others areas of the Framework.
Also if the problem is proved to be a bug, please pull fix in source files.

Similar errors also referenced here:
https://www.facebook.com/groups/delphimvcframework/permalink/1895046327245164/
#36
#315

But situations diferent in it owns ways

The real problem is not of DMVCFramwork, but of Embarcadero itself, as can be read here:
https://stackoverflow.com/questions/35708827/what-could-cause-no-mapping-for-the-unicode-character-exists-in-the-target-mult
The proposed solution is just a workaraound, but not the optimal one

Thanks.

I did the change. All the Unit Test are OK, but it's a border case. Can you provide a specific test which would arire the problem so that I can add the test in the unittest project?