Note that there are some explanatory texts on larger screens.

plurals
  1. PODelphi, TBlobField and UTF8
    primarykey
    data
    text
    <p>Here's my architecture :</p> <p>Datasnap Client &lt;=> Datasnap Server &lt;=> Oracle 11 XE</p> <p>I'm using a remote provider with TDSProviderConnection from the client side to access my dataset.</p> <p>Basically, I'm using a TIdHTTP component to query a website and store the result in an Oracle CLOB column.</p> <p>When saving result to a file, text, accented and other exotic characters are displayed correctly. same text inserted into a clob using sqldeveloper is displayed correctly as well.</p> <p>But when I'm doing this thru datasnap architecture, wrong characters shows up (like black diamonds or "upperscore" (underscore on top)</p> <p>My DB Charset is AL32UTF8, which is the default charset on Oracle 11 XE.</p> <p>To better understand where the problem is, I rewrote part of my client to access my database directly. And I can say the problem is not in the communication between datasnap client and server.</p> <p>Now my architecture is :</p> <p>Client &lt;=> Database</p> <p>And I access Oracle XE the following way :</p> <p>TClientDataSet &lt;=> TDataSetProvider &lt;=> TSQLDataSet &lt;=> TSQLConnection</p> <p>Response from TIdHTTP, which is a <code>TMemoryStream</code>, is stored in the TClientDataset with :</p> <pre><code> With ClientDataSet do begin Edit; (Fieldbyname('MYCLOBFIELD') as TBlobField).LoadFromStream(MS); ApplyUpdates(-1); end; </code></pre> <p>EDIT : 21st of may</p> <p>I did test around TBlobField and this component seems to be part of my problem. Let me explain :</p> <p>I took a random string containing characters from an extended charset like this : <strong>'ÐÒÙÜßąĀûÆ'</strong></p> <p>And with my ClientDataSet, changed the assignment to this :</p> <pre><code> FieldByname('MYCLOB').value := 'ÐÒÙÜßąĀûÆ'; // &lt;-- Inserted correctly into Oracle. </code></pre> <p>Putting this string in a file 'test.txt' and trying to display a popup with the content does not work :</p> <pre><code> var MyBlobField: TBlobField; begin MyBlobField.LoadFromFile('test.txt'); ShowMessage(MyBlobField.AsString); // &lt;-- does not display correctly </code></pre> <p>But Using a TMemo to display the content works like a charm :</p> <pre><code> var MyMemo: TMemo; begin MyMemo.Lines.LoadFromFile('test.txt'); // &lt;-- Works perfectly !! </code></pre> <p>I tried to set the <code>TBlobField.BlobType</code> property to <code>ftOraClob</code> or <code>ftBlob</code> with no luck.</p> <p>Finally, using a <code>TStringList</code> (what <code>TMemo.Lines</code> is actually) to load my string into Oracle does the trick.</p> <p>I guess either something is wrong with <code>TBlobField.LoadFromFile/LoadFromStream</code> or I'm not using it correctly.</p> <p>TStringList inherits its <code>LoadFromFile/LoadFromStream</code> method from TStrings, which works.</p> <p>Any help will be greatly appreciated. Regards.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload