Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 446721
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T21:29:56+00:00 2026-05-12T21:29:56+00:00

Over the past week I’ve been working on a roguelike game in C++ along

  • 0

Over the past week I’ve been working on a roguelike game in C++ along with a friend. Mostly too learn the language.

I’m using:

  • pdcurses
  • Windows 7
  • Visual studio C++

To output wchar_t‘s wherever I want to in the console. I have succeeded in otuputting some unicode characters such as \u263B (☻), but others such as \u2638 (☸) will just end up as question marks(?).

Here’s the relevant code I use for output.

// Container of room information

struct RoomInfo
{
    wchar_t * layout;
    int width;
    int height;
};

// The following function builds RoomInfo 

RoomInfo Room::examine(IActor * examinor)
{
    RoomInfo ri;
    ri.width = this->width;
    ri.height = this->height;
    ri.layout = new wchar_t[height * width];
    for(unsigned int y = 0; y < height; y++)
    {
        for(unsigned int x = 0; x < width; x++)
        {
            ri.layout[y*width + x] = L'\u263B'; // works
            //ri.layout[y*width + x] = L'\u2638'; // will not work
        }
    }
}

// The following function outputs RoomInfo

void CursesConsole::printRoom(RoomInfo room)
{
    int w = room.width;
    int h = room.height;

    WINDOW * mapw = newwin(h, w, 1, 0);
    for(int y = 0; y < h; y++)
    {
        wmove(mapw, y, 0);
        for(int x = 0; x < w; x++)
        {
            int c = y*w + x;
            waddch(mapw, room.layout[c]);
        }
    }

    wrefresh(mapw);
    delwin(mapw);
}

I could of course fall back on boring ANSI-characters. But it would be really awesome to have the complete unicode-set of characters to play with.

To sum it up: How do you make sure that unicode characters are outputted correctly?


Edit:

Ok, so I figured out my encoding is working correctly. The problem is that I need to force the terminal to switch to a more unicode-rich font face. Is there a cross-platform way to do this? is there even a windows specific way to do this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T21:29:56+00:00Added an answer on May 12, 2026 at 9:29 pm

    The problem is that I need to force the terminal to switch to a more unicode-rich font face. Is there a cross-platform way to do this? is there even a windows specific way to do this?

    I had a look for this, but couldn’t find a Windows API call to do it (which may just mean I didn’t find it, of course). I would not expect to find a cross-platform way to do it.

    The best solution I can think of is to launch the console using a specially constructed Shell Link (.LNK) file. If you read the file format documentation, you’ll see that it allows you to specify a font.

    But your problems don’t end there. A Western locale install of Windows provides Lucida Console, but that font only provides a limited subset of graphemes. I assume that you can output/input Japanese text in the console on a Japanese Windows PC. You’d need to check what is available on a Japanese Windows if you wanted to be sure it would work there.

    Linux (Ubuntu, at least) seems to have much better support here, using UTF-8 and providing a font with broad grapheme support. I haven’t checked other distros to see what the story is there, nor have I checked how fonts are resolved in the terminal (whether it’s an X thing, a Gnome thing or whatever).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been trying over the past week to implement H.264 streaming over RTP, using
I've been starting to learn Struts 2 over the past week or so and
I've been asking a question or two over the past few days of working
Over the past week or so I have been reading a lot of articles
Over the past several years I have been using the naming convention of FirstNameTxt
I have been working on an Android game for the past 6 months or
I've been having some serious challenges over the past week trying to implement the
I've been messing with a prob for past week over now ... I need
Over the past couple of days I have been reading into using autotools to
Background info: Over the past week, I have been messing around with Chrome extensions

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.