Search code examples
javacmdunicodeencoding

how can i print ⛀ from java with cmd.exe?


I need to print on cmd ⛀ this character. Its encoding in UNICODE is U+26C0. I tried with this: System.out.print("⛀"); but in running I get "?" character Thanks.


Solution

  • tl;dr

    Not a programming problem. Obtain and install a font containing a glyph for that particular character.

    A rare glyph

    For a character to appear, the computer must have a font containing a glyph for that particular code point number as defined in Unicode. No font comes even close to having glyphs for all of the 143,859 characters defined in Unicode. Any font has only a small subset of those.

    Your particular character, U+26C0 WHITE DRAUGHTS MAN, seems to be a rarity. This despite being defined in Unicode so long ago.

    My Apple iPad running the latest iPadOS in Safari does not display a glyph for that character on this page nor this page.

    Nor does it appear when running this code live at IdeOne.com.

            String whiteDraughtsMan = "\u26C0" ;
            System.out.println( whiteDraughtsMan ) ;
    

    You will need to obtain and bundle/install a font containing a glyph for that particular character. You could create your own font with your own glyph designs. You could purchase a font through any of several vendors. If none found, you could petition or commission any commercial vendor or open-source font project to add such glyphs to one of their products.