Re: Synchronet Door ANSI output
By: Darkside920 to All on Sat Sep 20 2025 09:54 pm
Hey all! I'm trying to write a door game in C++ and use it on my Sync install. Not for profit or anything, but to develop my coding skills (which are currently awful).
The project I'm working on is a blackjack game (not original, I know - please don't judge too harshly). This has already taught me a lot about C++, and I'm sure I'll learn a lot more as I go.
You can look at your Synchronet xtrn/sbj directory for an example Blackjack door game written (for Synchronet) in C.
Having overcome several hurdles, I'm at a loss with displaying the card suits using ANSI character codes. The ANSI color codes are working, but the suits show up as 3 accented letters, rather than the suit "icons."
Sounds like you're sending UTF-8 encoded characters to a non-UTF-8 terminal (would be my guess). Most BBS terminals (clients, e.g. SyncTERM, etc.) don't support UTF-8, but rather CP437 characters in straight 8-bit encoding. If the user's terminal supports CP437, then you want to send the control characters (low ASCII values) which correspond to those card symbols in the CP437 character set. Look up CP437 for details.
When I run the app locally (on the same machine Sync is running on), the suits show correctly.
Probably because when run locally, you're using a console/terminal that supports UTF-8.
I'm wondering if I need to change a setting in SCFG or even change how I'm creating the suit icons.
Any ideas?
My first idea is that I would write a new door game for Synchronet in JavaScript, not C or C++. That would be a lot easier. But if you're dead set on C++, then you need to learn about terminal capabilities, emulation, and character encoding and handle those differences in your own code (e.g. sending CP437 to a UTF-8 terminal will look like garbage, and vice versa).
--
digital man (rob)
Steven Wright quote #18:
Hard work pays off in the future; laziness pays off now.
Norco, CA WX: 74.5øF, 66.0% humidity, 1 mph WNW wind, 0.00 inches rain/24hrs ---
þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net