Printing unicode symbols in JavaLab

I have a student trying to print out unicode symbols in the console and they aren’t printing the way we are expecting. We are trying to use any of these eight for playing cards:
image
He currently has them as part of a String 2D array and enter the symbol as follows:
array[i][j] = “\u2660”;
And it prints out something nowhere near what we expected. Is our issue with them assigning it to a String and not a char? Or is it something in JavaLab that it doesn’t like to print out the unicode symbols?

Hi, thank you for sharing your question to the forum!

I wanted to let you know that I saw this, and am investigating it. I tried the simple fix you described, which would be changing it to a char and printing that, but I was not seeing the suit get printed with that approach, and instead saw a character I didn’t recognize. I will pass this question up to the team at Code.org, so that you can get some feedback on this for your student.

Best,
Lindsay

1 Like

Thank you for the update!

1 Like

Hi, I heard back from the team.

At this time, Java Lab does not support Unicode in the console output.

A few things your student could try instead are to just store the printed name of the suit in the 2D array(straightforward, but maybe not as visually pleasing), or they could try moving to a theater sandbox and use images for each suit (more of a lift in terms of re-working the project but could produce the intended look).

Thank you for posting this on the forum so that other teachers can benefit from your experience!

Best,
Lindsay

2 Likes

Thanks for the information! They’ll likely just go with the suit being printed in some way.

1 Like