Recent

Author Topic: problems with diacritics  (Read 2387 times)

Hansvb

  • Hero Member
  • *****
  • Posts: 918
problems with diacritics
« on: March 17, 2016, 08:31:44 pm »
I export a dataset to access. In the DBGrid on the form i see this value (tree name):
Quote
Tilia cordata 'Böhlje'   
This is good.

When i export the dataset to Access is get this value:
Quote
Tilia cordata 'Böhlje'

I think this has something to do with Ansi / utf8 so i tried the next 2 methods. Both gave the wrong result

Code: Pascal  [Select][+][-]
  1. DataModule_Access.SQLQuery_Access.Params.ParamByName('BOOMSOORT').AsString := Adbgrid.DataSource.DataSet.FieldByName('BOOMSOORT').AsString;
  2. DataModule_Access.SQLQuery_Access.Params.ParamByName('BOOMSOORT').AsString := AnsiToUtf8(Adbgrid.DataSource.DataSet.FieldByName('BOOMSOORT').AsString);

How to export the diacritics the right way to Access?
When i export to Tekst of xlsx there is no problem with the diacritics.



 

balazsszekely

  • Guest
Re: problems with diacritics
« Reply #1 on: March 17, 2016, 09:03:10 pm »
Access-->Microsoft-->UTF16-->WideString
DataModule_Access.SQLQuery_Access.Params.ParamByName('BOOMSOORT').AsWideString := Adbgrid.DataSource.DataSet.FieldByName('BOOMSOORT').AsString;
With FPC 3.0.0 it should work with a simple assignment. If not use the UTF8ToUTF16 function from lazutf8 unit.

Hansvb

  • Hero Member
  • *****
  • Posts: 918
Re: problems with diacritics
« Reply #2 on: March 17, 2016, 09:34:23 pm »
Thanks, that works

 

TinyPortal © 2005-2018