Losing data when saving Database fileds with "Size" defined and UTF8 chars
Original Reporter info from Mantis: dopidaniel
-
Reporter name: Daniel Simões de Almeida
Original Reporter info from Mantis: dopidaniel
- Reporter name: Daniel Simões de Almeida
Description:
When the FieldDefs.Size properties is defined and we are trying to save UTF8 characters with accented words, the Data is Truncated.
This affect all Database components, including third party components like ZeosDB
Steps to reproduce:
Considering the BufferDataSet Table below:
object BufDataset1: TBufDataset
FileName = 'teste.dat'
FieldDefs = <
item
Name = 'Cod'
DataType = ftInteger
Precision = 0
Size = 5
end
item
Name = 'Desc'
DataType = ftString
Precision = 0
Size = 10
end>
left = 136
top = 136
end
//This code save data Correctly:
BufDataset1.Append;
BufDataset1.Fields[0].AsInteger := 1;
BufDataset1.Fields[1].AsString := '1234567890';
BufDataset1.Post;
//This code lose the last 5 characters:
BufDataset1.Append;
BufDataset1.Fields[0].AsInteger := 2;
BufDataset1.Fields[1].AsString := 'áéíóú12345';
BufDataset1.Post;
Additional information:
I attached a Demo to demonstrate the problem.
Mantis conversion info:
- Mantis ID: 24745
- Build: 20130427-win32
- Version: 2.7.1
- Monitored by: » luizamerico (Luiz Americo)