Forum > General

Newbie Console App Question (CRT & Win)


Hello everyone I have a question that I've been trying for two days to figure out and I need some professional help! It should be so simple, but it's the simple things that get you right???

PROBLEM: I'm creating a console application, I didn't use the wizard generated custom app, I just started with a blank Program template. Everything went well and I started using FPC/Lazarus' CRT unit. However when I tried to use non-Roman characters (like Epsilon, Micro, Alpha, Beta, etc.) through the command string I get gibberish. e.g. WriteLn(#230) I wouldn't get 'Micro' I get 'Latin Small Letter ae'. So I tried to just copy and past the character into the WriteLn function. That didn't work either. As a matter of fact I couldn't even use Windows Altcodes to get the proper character to show up at a RedLn() prompt.
  Through about 3 1/2 hours of reading on Codepages (Not fun) I realize Windows uses something different then Codepage OEM 437 for Western computers. So I went to a Windows Console typed chcp and of course got back 437, and used the Altcodes and I got what I would expect. I also thought that I would just call the Win API SetConsoleOutputCP(437). This of course changed nothing, and I tried about five different codepages in an attempt to get something different and never could get it to work. ( I do understand it's Microsofts take on the IBM Codepage and that in effect they are they same thing, Windows just has a different idea of what the extended characters should be. I was grasping at straws to try to find something that would just work!)
  So I started up a new Lazarus project and used the Console App wizard, went in typed WriteLn(#230) and got exactly what I expected the Micro sign. Now if I add the CRT unit I find that it no longer works.
  This led me to believe that maybe CRT had a different incarnation of WriteLn then the standard, and I thought maybe I would have to specify unit name or something, only I can't find the definition of WriteLn anywhere.

MY CONCLUSION: Somehow whenever I use the CRT unit my program's console reverts to the Windows: Western character set, instead of DOS: United states. I have found no way to override this.

Could someone please offer me some insight or suggestions that would lead me in the right path? Or will I have to choose between color and proper characters???

Thanks for reading, sorry I'm such a newbie, hopefully you can help :D

P.S. To everyone who works on Lazarus and FPC... THANK YOU!!!!

EDIT: I've now found out that WriteLn and such like it are actually built into the compiler. LOL I told you I was a noob :D But I still have the same problem :'(


[0] Message Index

Go to full version