How to do SQL Query with special characters? lazarus / 16-Databases ---------------------------------------------------------------------- shobits1 · 2017-02-17 14:36 I have an MS-Access database (a .mdb file) that I want to do some work on. the problem I'm facing is that the tables names have some special characters like: é è ° (french naming) and the fields names in some table have the same issue. the TSQLQuery always raises an error when ever I do a SELECT with specific fields. I tried to use [] and `` but nothing works.. Code: MySQL  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i # does not workSELECT N°Ins      ,Réf_Group      ,Réf_SectionFROM `Etudiants` # does not workSELECT `N°Ins`      ,`Réf_Group`      ,`Réf_Section`FROM Etudiants # does not workSELECT [N°Ins]      ,[Réf_Group]      ,[Réf_Section]FROM Etudiants # works but displays fields names with ?SELECT * FROM Etudiants  Please help me. BTW... is it possible to use Zeos to connect to MS-Access database? how? Also I'm using the last official release of lazarus (v1.6.2) ---------------------------------------------------------------------- shobits1 · 2017-02-18 09:04 Anyone? ---------------------------------------------------------------------- Thaddy · 2017-02-18 09:16 Is the msaccess database in UTF8 format or in the French codepage? As long as the database encoding is UTF8 it should work. If it is in the French MS codepage you will need to do some extra work. ---------------------------------------------------------------------- shobits1 · 2017-02-18 10:46 it's not UTF8.. (it's an old .mdb file) what extra work, I need to do? BTW.. I tried the same file with delphi (XE6) and it works just fine. still I'd like to do this on lazarus (I need the FPSpreadSheet component). Thaddy,,, any guide/hint/help will be appreciated. ---------------------------------------------------------------------- shobits1 · 2017-02-19 14:46 Should I report this as bug or what?? ---------------------------------------------------------------------- Cyrax · 2017-02-19 15:04 Grab fpcupdeluxe and install development versions (the trunks) of FPC and Lazarus. Then do a test and if there is bug, then report. ---------------------------------------------------------------------- paweld · 2017-02-19 15:11 If database isn't utf8 format, then try like this: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i Query1.SQL.Clear;Query1.SQL.Add(' SELECT [N°Ins], [Réf_Group], [Réf_Section] ');Query1.SQL.Add(' FROM Etudiants ');//convert query to database codepageQuery1.SQL.Text:=UTF8ToCP1252(Query1.SQL.Text);Query1.Open;Add LConvEncoding to uses section. ---------------------------------------------------------------------- shobits1 · 2017-02-19 16:39 Cyrax, the problem persist on at least the trunk from December's 25... this maybe due to FPC using UTF8 by default internally; I don't really know but I think this is the case since paweld's code works fine. Thanks,, Paweld... converting the SQL query from UTF8 to ANSI did the trick. Now, I can switch back from Delphi and continue my work. ---------------------------------------------------------------------- Cyrax · 2017-02-19 18:11 Then you probaly need to add ${codepage utf8} somewhere after {$mode objfpc}{$H+} stanza. ---------------------------------------------------------------------- shobits1 · 2017-02-19 18:42 Quote from: Cyrax on February 19, 2017, 07:11:50 pmThen you probaly need to add {$codepage utf8} somewhere after {$mode objfpc}{$H+} stanza. does not work.