RTC Forums
March 28, 2024, 11:24:29 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
 
   Home   Help Login Register  
Pages: [1]
  Print  
Author Topic: Simple DB Client/Server Scenario with Arabic Characters  (Read 3086 times)
mulhams
RTC Expired
*
Posts: 1


« on: March 12, 2017, 10:00:57 AM »

I'm taking my very first steps with RTC. I was following the articles in the classroom for database Server/Client access. I managed to make everything work fine but the Arabic characters in my SQL Server don't show up correctly in the grid (they show up as 'Huh?'). Am I missing something here? I'm using UniDAC components.

Thanks.
Logged
D.Tkalcec (RTC)
Administrator
*****
Posts: 1881


« Reply #1 on: March 12, 2017, 11:06:44 AM »

Even though functions from the "rtcDB" unit (which are provided out-of-the-box) for copying data to and from TDataSet descendants make things easier in the beginning and should work for most field types, these functions can NOT automatically recognize and translate all field types provided by all Database Access components. This is especially true for fields containing Unicode text and binary data.

To correctly extract your data from a TDataSet descendant component and copy that data to a TRtcDataSet component, you should copy the "DelphiDataSetToRtc" function implementation from the "rtcDB" unit into one of your own units, give it a different name and modify your version to correctly copy all DB Field types you are using with Database Access components of your choice.

Also, while using the "Value" property on RTC Value objects should work for the most common data types, in case your data is stored in a special format or encoded in a certain way, you have to read the contents by using the same format used while storing it and decode it after reading - if necessary.

For example, the "TRtcDataSet" class use the "asText" property for storing and transporting Unicode strings, while the "asString" property only stores and sends the lower 8-bits of each character, so make sure to use "asText" with Unicode strings on both sides (Client and Server) instead of "asString" - if the Database access components you are working with have full Unicode support.

Best Regards,
Danijel Tkalcec

Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.022 seconds with 16 queries.