#1 2014-02-20 12:33:08

DigDiver
Member
Registered: 2013-04-29
Posts: 137

TSqlRawBlob and international charachers

The model contains TSqlRawBlob field.
When field data is transferred via JSON it is encoded as SQLite3 BLOB literals (X'53514C697465' e.g.)

 TMode = class(TSqlRecord)
 ...
 published property Source: TSqlRawBlob read FSource write FSource;
...

 FModel.Source := StringFromFile(FileName);

 Ctxt.Returns(ObjectToJSON(FModel,[]));


The file content:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> 
 
<html> 
<head> 
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> 
 
  <title></title> 
</head> 
 
<body> 
  <p>Привет Алекс Саша</p> 
</body> 
</html>

After content is transmitted via JSON and decoded on the client (or server) side, the source file content is different:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> 
 
<html> 
<head> 
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> 
 
  <title></title> 
</head> 
 
<body> 
  <p>Привет Алекс Саша</p> 
</body> 
</html>

I think that the problem is in the TSQLRawBlobToBlob function

Offline

#2 2014-02-20 13:53:41

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,661
Website

Re: TSqlRawBlob and international charachers

Why on earth are you putting text in a BLOB fields?

Issue is probably not even within the mORMot code, but in how the RawByteString is converted into string on your platform.

Offline

Board footer

Powered by FluxBB