'Problem with printing certain type of characters

I have a function to print a binary tree:

  void printMe(const std::string& prefix, BinaryNode* node, bool isLeft)
    {
        if( node != nullptr )
        {
            std::cout << prefix;
            std::cout << (isLeft ? "├──────" : "└──────" );

//         print the value of the node
            std::cout << " (" <<nod->key<< ")" << " "<< std::endl;;

//         enter the next tree level - left and right branch
            printMe( prefix + (isLeft ? "│       " : "        "), node->right, true);
            printMe( prefix + (isLeft ? "│       " : "        "), node->left, false);
        }
    }

    void printMe()
    {
        printMe(" ",this->root, false);
    }

As you see, I'm trying to print special charactars ├──────

When I try to compile, I get an error that the encoding methode have change since Im tring to use illegal characters. How can I print those characters anyway ?

Im using codeBlocks as my IDE, and the encoding is UTF-8.

When I try to print a tree this is an example to the output I get:

enter image description here

If anyone knows how to fix it, I'll be very greatful.

Thanks in advance.

c++


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source