-
-
Notifications
You must be signed in to change notification settings - Fork 375
Description
Hello everyone, 😍
ActiveRecord can't store unicode data correctly. I am using activerecord_showcase sample and trying to store some unicode text in database but data will be appear like ????? in database table! also 'CharacterSet=UTF8' parameter added into connection but wrong result appears again. I am using firebird3 and DMVC carbon edition.
✳️For reproduce problem you can try to store this string:
'این یک تست است!'
1️⃣ Update 1: this problem appears when English(United States) selected in this path in windows 10:
Control Panel>Region>Administrative>Change system locale...
2️⃣ Update 2: When Persian(Iran) selected from previous path then It works correctly. Is It possible to configure DMVC's ActiveRecord to working in any situations without changing Windows settings?
3️⃣ Update 3: bug solved 🙂
For solving this problem follow below steps:
- In MVCFramework.ActiveRecord.pas unit.
❌change below section:
ftUnknown, ftString, ftWideString:
begin
aParam.AsString := aValue.AsString;
end;
✅ To this:
case aParam.DataType of
ftUnknown, ftString, ftWideString:
begin
aParam.AsWideString := aValue.AsString;
end; - And in MVCFramework.ActiveRecord.pas unit.
❌change below section:
{$IF Defined(SeattleOrBetter)}
tkWideString:
begin
aParam.AsString := aValue.AsString;
end;
{$ENDIF}
✅ To this:
{$IF Defined(SeattleOrBetter)}
tkWideString:
begin
aParam.AsWideString := aValue.AsString;
end;
{$ENDIF}
Special thanks for DMVC Framework team and specialy for Daniele Teti