source UTF-8 in Win 7 lazarus / 21-General ---------------------------------------------------------------------- Nicole · 2022-08-25 09:45 There is an option for Win 10 to have the source in UTF-8. How to do this with Win 7? ---------------------------------------------------------------------- KodeZwerg · 2022-08-25 09:51 QuoteThe Unicode support is enabled automatically for LCL applications since Lazarus 1.6.0 when compiling with FPC 3.0+.https://wiki.freepascal.org/Unicode_Support_in_Lazarus Or i might misunderstand what you want to achieve. ---------------------------------------------------------------------- PascalDragon · 2022-08-25 11:28 Quote from: Nicole on August 25, 2022, 11:45:44 amThere is an option for Win 10 to have the source in UTF-8. How to do this with Win 7? Are you maybe confusing something here? Your source can be in any encoding supported by the compiler no matter the platform (and UTF-8 is supported). What you might mean is the option “ANSI codepage is UTF-8”, but that has nothing to do with the code page of your sources, but the code page of the *A-WinAPI functions which can only be UTF-8 starting from Windows 10 1903 on. ---------------------------------------------------------------------- Nicole · 2022-08-25 12:35 I have the problem that ShowMessage ("außerordentich tüchtig im mächtigen Möbellager"); looks strange sometimes because of the ß and the ü. This was never the case in Delphi where the code is from 1:1. ---------------------------------------------------------------------- Thaddy · 2022-08-25 12:48 Quote from: Nicole on August 25, 2022, 02:35:09 pmThis was never the case in Delphi where the code is from 1:1. That depends on the Delphi version. E.G. a German < D2009 Delphi uses Ansi codepage 1252 for German (if the computer has a German OS version) by default. More modern Delphi's use UTF16. Lazarus use UTF8, which is also a special codepage CP_UTF8. So which Delphi version are you referring to? ---------------------------------------------------------------------- KodeZwerg · 2022-08-25 13:34 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   ShowMessage('außerordentich tüchtig im mächtigen Möbellager');  Application.MessageBox(PChar('außerordentich tüchtig im mächtigen Möbellager'), PChar('Caption')); Works both same good here, tested with Windows 7 in a VM. ---------------------------------------------------------------------- KodeZwerg · 2022-08-25 13:35 Quote from: Nicole on August 25, 2022, 02:35:09 pmlooks strange sometimes What means "sometimes" ? ---------------------------------------------------------------------- Nicole · 2022-08-25 15:44 What means "sometimes" - is really good a question. I have no idea. Originally, all my pas-files come from Delphi and Win 7. Letters are no topic there, just worked. Lazarus: Sometimes a "stringlist.saveToFile" does its work, sometimes the coding is damaged. Same with showmessages. Sometimes it is ok, somtimes the letters are damaged / forced to ASCII signs. My idea was: Put them all to UTF8, but I seemed to have misunderstood the option. Thank you for the link about Unicode and Lazarus. Probably there is the answer. Unfortunately, the information overwhelms me. What do you recommend? ---------------------------------------------------------------------- KodeZwerg · 2022-08-25 16:53 Quote from: Nicole on August 25, 2022, 05:44:03 pmWhat do you recommend? Find a small source file that show us that behave would be best  In my thinking it may be like you have old sources, encoded in Ansi (the source file itself), compiling with a utf-8 parser would lead to such manners i guess. So a quick work-around might be to get Notepad++, in batch mode add all your source files and let them saved to utf-8. But it is just a guess, no guarantee given!!! ---------------------------------------------------------------------- Nicole · 2022-08-25 17:27 Thank you. You probably are right in all points and the conclusion. I will do so. ---------------------------------------------------------------------- KodeZwerg · 2022-08-25 17:47 When i do read the documentation correct, all you have to do is to include 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 {$codepage utf8} ---------------------------------------------------------------------- PascalDragon · 2022-08-26 07:06 Quote from: Nicole on August 25, 2022, 05:44:03 pmWhat means "sometimes" - is really good a question. I have no idea. Originally, all my pas-files come from Delphi and Win 7. Letters are no topic there, just worked. Lazarus: Sometimes a "stringlist.saveToFile" does its work, sometimes the coding is damaged. Same with showmessages. Sometimes it is ok, somtimes the letters are damaged / forced to ASCII signs. You should check what the encoding of your files is. If you open your file with a hex editor are the umlauts a single Byte or multiple Byte (UTF-8)? Is there a Byte-Order-Mark at the top of the file, especially one for UTF-8 ($EF $BB $BF)? If this BOM is not present, but the characters are encoded as UTF-8 then the compiler will wrongly treat them as its default ANSI codepage. If the BOM is present, but the characters are not encoded as UTF-8 then the compiler will wrongly treat them as UTF-8. In both cases this will lead to wrongly encoded constant strings and thus garbage in the end. So: if the characters are UTF-8, but the BOM is missing, you either need to add the BOM or add {$codepage utf8}. If the characters are not UTF-8, but there is a BOM you best remove the BOM.