[SOLVED] SQLDB: UTF8 problem in Postgresql lazarus / 16-Databases ---------------------------------------------------------------------- mmelwin · 2021-02-04 20:53 I have set: 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   SQL1.SQL.Clear;  SQL1.SQL.Add('SET CLIENT_ENCODING TO ''UTF8'';');  SQL1.ExecSQL; But when moving values from one query to another. When a string contains national characters. 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 SQL1.SQL.Add('and m='''+Form1.SQLQueryTre['m']+''''); I have an error: 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 Invalid byte sequence for encoding "UTF8" What could be wrong? ---------------------------------------------------------------------- winni · 2021-02-04 21:11 Hi! Three apostrophe in the beginning and 4 in the end - that does not fit. To get rid of the eyepowder '''' use #39! Winni ---------------------------------------------------------------------- lucamar · 2021-02-04 21:54 No, the apostrophes are all right as they are. The problem has to be in: Form1.SQLQueryTre['m'] Check what it is returning (both as chars and as bytes); it's possible that at some point or other it's getting converted to some Windows/ISO code-page and it's not re-converting back to UTF-8. ---------------------------------------------------------------------- mmelwin · 2021-02-05 07:45 Everything was explained. However, the problem was with another string. Project is from delphi 2007 conversion. Some *.pas files were in ANSI and not UTF8. Everything works after conversion.