NO

Author Topic: Unicode and Wide characters in Terminal apps using Pelles C  (Read 244 times)

Offline stbradley

  • Member
  • *
  • Posts: 1
Unicode and Wide characters in Terminal apps using Pelles C
« on: November 04, 2021, 08:43:39 pm »
Greetings,

I have occasionally wanted to create a Terminal program that uses Greek letters, superscript and subscript numbers and some scientific symbols. I found that this can easily be done using Unicode. Additionally, C and C++ handle Unicode as wide characters (wchar_t) and have many functions available for handling them. So, naively, I thought this would easily solve my problem and I could write my program. But I'm not so lucky. And thus began the 2020 Console Video project (COVID-20). (2020 because I started working on it in 2020).  ;D

As anyone who has tried to use Unicode or wide characters in C or C++ will soon discover your Terminal will not display Unicode or wide characters correctly. It turns out that not only does displaying these characters properly depend on what OS you are using, it depends on what compiler you use. So I have created the single header "unicoder.h" that hides the dirty work from you by figuring out what OS (Windows or Linux) and compilers, IDEs (Pelles C or see listing included in documentation for others) you are using and then setting things up so that you can display wide characters and Unicode easily. It also includes many definitions of Unicode characters for your convenience.

I have also added some features to Unicoder that let you turn on/off underline, bold fonts and color font/background, etc..

On the off chance someone might be interested in using Unicode or wide characters you can find Unicoder here:
https://github.com/sthomasbradley/Unicoder

I am announcing this here solely because I included Pelles C as one of the IDEs I tested.  I am aware that Pelles C does quite a nice job handling Unicode.
See Ya
STB

Offline Grincheux

  • Member
  • *
  • Posts: 351
  • Never be pleased, always improve
    • Arachne
Re: Unicode and Wide characters in Terminal apps using Pelles C
« Reply #1 on: November 04, 2021, 09:02:05 pm »
Thank for the comments and the source code.
I will have a look because Unicode is not what I know the best.
Now, we have no choice for usng Unicode, starting with an example is welcome.
-------------------------
Kenavo / Bye

What disturbs me the most is not dying but not knowing what I will do after.

Offline frankie

  • Global Moderator
  • Member
  • *****
  • Posts: 1882
Re: Unicode and Wide characters in Terminal apps using Pelles C
« Reply #2 on: November 06, 2021, 10:45:43 am »
Good job.
Thanks for info e for the sharing  :)

Offline John Z

  • Member
  • *
  • Posts: 385
Re: Unicode and Wide characters in Terminal apps using Pelles C
« Reply #3 on: November 06, 2021, 02:55:51 pm »
Hi stbradley,

I don't know if I'll need this but I want to applaud you for the documentation you provide for the Unicoder project!
Excellent work with examples etc.  This will definitely make the capability you are providing more usable.

Well Done!

John Z