FP in Linux Mint Terminal crazy characterset lazarus / 64-FPC development ---------------------------------------------------------------------- alfware17 · 2019-03-09 15:58 Hi, I normally program in Windows 7 using the Free Pascal IDE less or more or the comand line compiler. Now I tried to port a batch program to run in Linux Mint 17. So far it works all BUT: my writeln - outputs dont show german special characters Ä Ö Ü or ß and so on. Simply on desktop - I didnt gone into detail yet to study if the files are correct, any logic and so on. I tried both. in the IDE (lol the characters can be seen there but not then in the running program) and in Terminal using comand line compiler,  I can type ä ö ü in the terminal all fine. Showing me the source .pas in Krusader using F3 or F4 shows problems (sorry I am Linux beginner). I just thought about transforming my source into UTF8 by tool as I did for one Java/Eclipse project before. But I remember another project in LAZARUS (now no batch but OO) where I could use the sources as well in both Windows and Linux Mint. And now the special effect. I created "hello world" program in the FP IDE (started by simply FP in the terminal) and wanted to writeln('ÄÖÜß') direct from keyboard. My typed letters where translated  into some cryptic. Run the program - ok Ä Ö Ü ß on the screen. But: creating a string constant with that content, writeln it - problem again. Counting any single char of the string, writeln the char and the ORD code - problem. For i:=1 to 255 do write(CHR(i)) - you may imagine, after 128 problem, What do I make wrong? Anybody can tell me, whos ghosting me? Linux? The terminal? Free Pascal? If it helps, I have one more indiz: The only one line of code I disabled in my origin source code when porting from Windows to Linux, was DefaultSystemCodePage:=TextRec(Output).CodePage;  I got compiler error - dont know why by now. But I thought first solve the crazy "hello world" behaviour then look, if my Windows Codepage problem with the data is still needed in Linux. Thank you for any help Bernd ---------------------------------------------------------------------- howardpc · 2019-03-09 16:10 If you are using the Mint default Terminal app it has a six-item main menu: File Edit View Search Terminal Help. The first item in the "Terminal" menu is "Set character encoding ->" which gives you a massive drop-down of possible choices, and you need to ensure that you encode the characters your app sends to the Terminal in the way it expects to interpret them. ---------------------------------------------------------------------- engkin · 2019-03-09 16:16 Using DefaultSystemCodePage:=TextRec(Output).CodePage; in Windows, implies that you are using ANSI, intentionally, instead of UTF8. You are supposed to do the opposite, unless you have a very good reason. Edit: I found your previous thread. ---------------------------------------------------------------------- alfware17 · 2019-03-10 17:37 @ engkin. Yes I solved that in Windows. The problem is, most of my data is Ansi (old stuff from Turbo pascal and so on). For new data I dont need and probably not in Linux but for Win 7 its tested/needed and runs. I deleted for Linux. @howardpc: I have the "default" Linux Mint from Live DVD installed and some new packages but I guess I never changed the terminal. Showing me properties called "gnome-terminal". There is NO menue. Do you advise any other? I havent any chance to try another Linux by now, maybe in a virtual box. What make me really curios: when I type in the IDE and press say Ä key, it translates and includes some cryptic into the source code? And then RUN - shows the described funny things, somes like that, somes other? ---------------------------------------------------------------------- howardpc · 2019-03-10 18:55 Right-click on the terminal. Gnome Terminal has a menu option "Show Menubar". Or choose the Preferences option to open a dialog where under General you can check the option "Show menubar by default in new terminals". ---------------------------------------------------------------------- alfware17 · 2019-03-11 18:01 Hi howardpc, my terminal has preferences but no menue  what general preferences do you mean? Sorry, my Linux Mint is in German and I am not sure where to find. But I searched for... I thought by myself - a picture says more than 1000 newbie words and made some screenshots. Is the link allowed here? Sorry I hate that screenshot function in Linux, it makes me big megabytes. And I tried to a) cut b) compress - its still big but no letter to be seen. So look for my dropbox link please and admin dont kill me (nothing found against in the FAQ) https://www.dropbox.com/sh/0u2wm9ji0drzt2q/AACHE9- DFlInJhb15LkhN1k6a?dl=0 The Shot5 is my terminal. Shot 1 until 4 shows my problem. Probably one way could be to take the source into IDE and change manually all comments in the writeln I can find to be wrong??? But I didnt need to do with the Lazarus IDE? Or second solution, convert the whole source to UTF8 before using it in Linux- I know, its only the comments I can see as output of the program in the terminal. I didnt spent any thought or idea what happens if the data/files could not be longer processed because of the 1 or 2 bytes per character problem. I dont want to know about that - first the outputs ---------------------------------------------------------------------- engkin · 2019-03-11 19:39 shot1 shows that: The terminal is expecting UTF8. Krusader is not using UTF8, and most likely some ANSI. See if you can make Krusader use UTF8. shot2 shows that: The IDE is not using UTF8 either. The IDE is using ANSI, but not the same codepage as Krusader I don't think the IDE is able to use UTF8. shot3 and shot4 confirm that terminal is using UTF8. ---------------------------------------------------------------------- howardpc · 2019-03-11 20:43 alfware17 - Sorry, we may be referring to different set-ups. I was referring to the Mint 19 Cinnamon desktop which has the Gnome Terminal as shown below. ---------------------------------------------------------------------- alfware17 · 2019-03-12 13:00 @ engkin: hm, by now the only way to satisfy the Terminal seems to be - load the source into IDE and then repair manually. Not 21st century like but ok. But then I have 2 sources - Linux and Windows - and must synchronize.   Do you know any other extern Editor working fine with FPC and producing german signs?   FPC version is 2.6.2 come with the Lazarus. Dont know if update would help, but Linux Mint is rather not updating   The other question would be, if somebody else uses my binary in another Terminal, what happens? - another solution I could try is to use my UTF8-Unit I build for another Lazarus project I had problems with but now working fine.   have there a "writeutf8ln" and it does for me.   The problem is, I used a unit LConvEncoding comes with Lazarus seems FPC doesnt include it.   Is there any comparable in FPC? ---------------------------------------------------------------------- Thaddy · 2019-03-12 13:16 Quote from: alfware17 on March 12, 2019, 02:00:46 pm  FPC version is 2.6.2 come with the Lazarus. Dont know if update would help, but Linux Mint is rather not updating FPC 2.6.2. is more than five years old...... And unmaintained for three. We simply can't test those things.... ---------------------------------------------------------------------- engkin · 2019-03-12 17:50 Quote from: alfware17 on March 12, 2019, 02:00:46 pm  Do you know any other extern Editor working fine with FPC and producing german signs? Lazarus.  You can even choose/change the encoding of the file: Right Click >> File Settings >> Encoder Quote from: alfware17 on March 12, 2019, 02:00:46 pm  FPC version is 2.6.2 come with the Lazarus. Dont know if update would help, but Linux Mint is rather not updating FPC 2.6.2 does not know about code pages. If you update, Thaddy would help you as well. Quote from: alfware17 on March 12, 2019, 02:00:46 pm  The other question would be, if somebody else uses my binary in another Terminal, what happens? As long your code does not have anything specific to your system, probably it will show the same results. Quote from: alfware17 on March 12, 2019, 02:00:46 pm  The problem is, I used a unit LConvEncoding comes with Lazarus seems FPC doesnt include it.   Is there any comparable in FPC?  Newer versions do. Your WriteUTF8Ln, assuming zeile has the correct code page, become: 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 procedure WriteUTF8Ln(zeile: string);begin   //WriteLn(CP1252toUTF8(zeile));   SetCodePage(RawByteString(zeile), 65001{UTF8}, True{Convert});   WriteLn(zeile);end; If zeile does not hold the correct code page: 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 procedure WriteUTF8Ln(zeile: string);begin   //WriteLn(CP1252toUTF8(zeile));   SetCodePage(RawByteString(zeile), 1252{cp1252}, False{Do not Convert});   SetCodePage(RawByteString(zeile), 65001{UTF8}, True{Convert});   WriteLn(zeile);end; ---------------------------------------------------------------------- alfware17 · 2019-03-13 13:19 Ok thanks so far. I guess I must look for newer FPC in Linux. Another problem I faced this morning - other people/other terminal cannt even run my binary. because my Lazarus/FPC produces 64bit binaries (but she has 32bit OS). I didnt even known or care until now. Or say until last year, I used 32bit exclusively, was the "small". OK, the live DVD was 64bit, so thats clear without me knowing that I am the incompatible "big" Seeing that I think I would need a newer Lazarus/FPC but 32bit to solve both UTF-8 and other people terminal problems. I did that already in Windows, have 2 different directories, 2 installations, 2 icons and it works fine I can choose. But in Linux I am a newbie. Simply getting the .deb packages and install them parallel to the existing one (I dont want to lose some working)? Keeps my sqlite alive and reachable for both installations? The older Lazarus (1.4 may be I remember and FPC 2.6.2) came from pre- installed package.  I am not sure about what happens, even if I can choose different directories for installing? ---------------------------------------------------------------------- Cyrax · 2019-03-13 16:04 Quote from: alfware17 on March 13, 2019, 02:19:27 pmOk thanks so far. I guess I must look for newer FPC in Linux. Another problem I faced this morning - other people/other terminal cannt even run my binary. because my Lazarus/FPC produces 64bit binaries (but she has 32bit OS). I didnt even known or care until now. Or say until last year, I used 32bit exclusively, was the "small". OK, the live DVD was 64bit, so thats clear without me knowing that I am the incompatible "big" Seeing that I think I would need a newer Lazarus/FPC but 32bit to solve both UTF-8 and other people terminal problems. I did that already in Windows, have 2 different directories, 2 installations, 2 icons and it works fine I can choose. But in Linux I am a newbie. Simply getting the .deb packages and install them parallel to the existing one (I dont want to lose some working)? Keeps my sqlite alive and reachable for both installations? The older Lazarus (1.4 may be I remember and FPC 2.6.2) came from pre- installed package.  I am not sure about what happens, even if I can choose different directories for installing? You should do some research on LXC containers and create a i386 container for Debian distribution.