[Lazarus] Charset in TSdfDataSet

GLBX LBX at swing.be
Thu Sep 6 12:49:07 CEST 2012


Right !

with Textout, I get accents correctly

but... when I post the changes, now, I get the problem

Originally DAMMANS

Changed to DéMMANS

Display after editing
DéMMANS (coorect)

Saved in the CSV file as !!!!!
DéMMANS 
and...

when I display after new loading :
DéMMANS       (!!!!?!?!?!)

Oups !!

GLBX
  ----- Original Message ----- 
  From: Mattias Gaertner 
  To: Lazarus mailing list 
  Sent: Thursday, September 06, 2012 12:04 PM
  Subject: Re: [Lazarus] Charset in TSdfDataSet



  GLBX <LBX at swing.be> hat am 6. September 2012 um 11:36 geschrieben: 
  > Hi, 
  > 
  > I checked the encodings and got : 
  > 
  > - GuessEncoding(dataset .fields[1].asString) and got UTF8 
   
  Keep in mind that it is impossible to reliably get the codepage of a text, unless the text begins with a BOM. GuessEncoding simply checks if the string validates some UTF-8 rules. If it is valid it returns UTF-8 otherwise the system code page. 
   

  > - [application]defaultTextEncoding = cp1252 
  > 
  > Now in DBGrid I wrote in DrawColumnCell : 
  > ... 
  > ExtTextOut( .... UTF8ToISO_8859_1(dataCSV.Fields[datacol].AsString......) 
  > and..... 
  > Now accents are correctly displayed... 
   
  It seems you are calling the windows API function ExtTextOut directly instead of the x-platform LCL one. The LCL one expects UTF-8, so you don't need the conversion. 
   
   
  > But I will get the problem back when validating changes in fields !!! 
  > (I Tried with OnSetText : but inefficient !) 
   
  Mattias 
   


------------------------------------------------------------------------------


  --
  _______________________________________________
  Lazarus mailing list
  Lazarus at lists.lazarus.freepascal.org
  http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20120906/c11002eb/attachment-0003.html>


More information about the Lazarus mailing list