* * *

Author Topic: ASCII PROBLEMS WITH WINDOWS VERSIONS  (Read 2004 times)

Synaii

  • Newbie
  • Posts: 3
ASCII PROBLEMS WITH WINDOWS VERSIONS
« on: May 02, 2018, 06:34:28 am »
Hello guys, im programming a mini game using FPC in windows 7.. and my code cant run in windows 10, because ascii is bugged.. can you help me?

This characters are bugged in windows 10:
#177, #30, #31, #16, #17


tr_escape

  • Sr. Member
  • ****
  • Posts: 341
  • sector name toys | respect to spectre
    • Github:
Re: ASCII PROBLEMS WITH WINDOWS VERSIONS
« Reply #1 on: May 02, 2018, 06:49:57 am »
Could you please send and example project for testing?
Is your project a console or a form project?

Handoko

  • Hero Member
  • *****
  • Posts: 2598
  • My goal: build my own game engine using Lazarus
Re: ASCII PROBLEMS WITH WINDOWS VERSIONS
« Reply #2 on: May 02, 2018, 07:09:09 am »
@Synaii

Have you try SuperFastConsole? Someone had ASCII displaying problem but it's solved using SuperFastConsole unit:
http://forum.lazarus.freepascal.org/index.php/topic,29352.msg185276.html#msg185276

You can get the unit here:
http://forum.lazarus-ide.org/index.php/topic,29291.msg184756.html#msg184756
« Last Edit: May 02, 2018, 08:06:24 am by Handoko »

Thaddy

  • Hero Member
  • *****
  • Posts: 6880
Re: ASCII PROBLEMS WITH WINDOWS VERSIONS
« Reply #3 on: May 02, 2018, 11:35:11 am »
Naaaaah, codepage problem.
Show us why it does not work wuth code and check which codepage YOUR windows is using.
Type just chcp in a console and report back.
Ada's daddy wrote this:"Fools are my theme, let satire be my song."

Synaii

  • Newbie
  • Posts: 3
Re: ASCII PROBLEMS WITH WINDOWS VERSIONS
« Reply #4 on: May 02, 2018, 07:13:07 pm »
I tried many things, a colleague told me that the problem was codepage, but I do not understand it, I tried to search to find out, but even then I did not understand it either.

Code: Pascal  [Select]
  1.  Const Jogador_E = #17;
  2.            Jogador_D = #16;
  3.            Jogador_C = #30;
  4.            Jogador_B = #31;
  5.            Teleporte_De = #207;
  6.            Parede_De = #177;
  7.           BarraHP_De = #177;
  8.    ...
  9. DesenhaXY(Jogador.Tipo[8], Jogador_E, Jogador.Tipo[5], Jogador.Tipo[6]);
  10. DesenhaXY(Jogador.Tipo[8], Jogador_D, Jogador.Tipo[5], Jogador.Tipo[6]);
  11.  

These characters will only be useful for the visual.

Prints of my project:
My screen (Windows 7): https://imgur.com/a/nsuoPeX
My friend's screen (Windows 10): https://imgur.com/a/mwHASUx

My codepage is 850.

@Att: Im using the unit Super..
Is correct? https://imgur.com/a/BKIzQkb .. the executable of my game, and the unit super.o and .ppu in same past

download: http://www.mediafire.com/file/faiz2s85il0hilq/GadesWay.rar

Thank you guys for help me!
« Last Edit: May 02, 2018, 07:53:57 pm by Synaii »

ASerge

  • Hero Member
  • *****
  • Posts: 937
Re: ASCII PROBLEMS WITH WINDOWS VERSIONS
« Reply #5 on: May 03, 2018, 05:20:25 pm »
Try this simple program on Win7 and Win 10 and see the result.
Code: Pascal  [Select]
  1. {$MODE OBJFPC}
  2. {$APPTYPE CONSOLE}
  3. program Project1;
  4.  
  5. const
  6.   C = #17#16#30#31#207#177;
  7.  
  8. procedure Print;
  9. var
  10.   ShortS: ShortString = C;
  11.   AnsiS: AnsiString = C;
  12. begin
  13.   Writeln;
  14.   Writeln('ShortString = ', ShortS);
  15.   Writeln('AnsiString  = ', AnsiS);
  16. end;
  17.  
  18. begin
  19.   Writeln('DefaultSystemCodePage = ', DefaultSystemCodePage);
  20.   Writeln('ConsoleCodePage       = ', TextRec(Output).CodePage);
  21.   Print;
  22.   SetMultiByteConversionCodePage(TextRec(Output).CodePage);
  23.   Writeln;
  24.   Writeln('DefaultSystemCodePage = ', DefaultSystemCodePage);
  25.   Print;
  26.   Readln;
  27. end.

Remy Lebeau

  • Sr. Member
  • ****
  • Posts: 464
    • Lebeau Software
Re: ASCII PROBLEMS WITH WINDOWS VERSIONS
« Reply #6 on: May 04, 2018, 03:17:08 am »
This characters are bugged in windows 10:
#177, #30, #31, #16, #17

#177 is not an ASCII character.  ASCII only goes up to #127.  Anything between #128-#255 is codepage-dependent.

#16, #17, #30, and #31 are all non-visual control characters, you shoun't be trying to print them out visually.
Remy Lebeau
Lebeau Software - Owner, Developer
Internet Direct (Indy) - Admin, Developer (Support forum)

Handoko

  • Hero Member
  • *****
  • Posts: 2598
  • My goal: build my own game engine using Lazarus
Re: ASCII PROBLEMS WITH WINDOWS VERSIONS
« Reply #7 on: May 04, 2018, 12:01:14 pm »
@Synaii

Your GadesWay looks good, unfortunately I don't understand the language. Maybe you can consider to use English.

Below are the screenshots of your game running on my Linux - Wine:

Synaii

  • Newbie
  • Posts: 3
Re: ASCII PROBLEMS WITH WINDOWS VERSIONS
« Reply #8 on: May 04, 2018, 11:37:15 pm »
Hello everyone, thank you for helping me .. I updated the game to English, and I did the tests they asked for, but honestly, I do not understand much of what they are asking me to do .. hahah, I'm sorry. I replaced the characters that were in trouble.

Link updated: http://www.mediafire.com/file/v2ajwmaagucgox3/GateWays.rar
The source code is in .rar
« Last Edit: May 05, 2018, 07:12:24 pm by Synaii »

 

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus