+ 1

Why can't I print Greek letters?

I've tried on both the web and mobile code playgrounds' and in each case, when I try to run https://code.sololearn.com/cwzJWnneFor8/#cs the results are the same: 1. I get only a subset of Greek letters (for instance, no zeta, ζ); the rest get printed as '?'; 2. I get the wrong case for some letters (like both lowercase and capital alpha come out as α, neither as Α); 3. Some letters are only available in one case (like β, µ in only lowercase and Γ, Θ, Ω only in capitals). Only sigma σ/Σ and phi φ/Φ print correctly in both lowercase and capitals. I read up on printing Unicode to console in C#, and I tried to most-frequently suggested solution, changing OutputEncoding to UTF-8, but as you see, that just results in weird mojibake (junk characters). Entirely missing a theta θ suggests to me it isn't a font issue—what fonts have a lowercase tau, but no lowercase gamma or theta? I'd appreciate any solution that will print these characters. I tried every way I could think of in this code. Thanks!

22nd Oct 2018, 12:30 AM
Trey Harris
Trey Harris - avatar
3 Respostas
+ 4
Change the stream encoding, send the BOM: https://code.sololearn.com/cklUIcf7MPwG/?ref=app I had to select UTF8 here, but I think I'm sending the utf16 BOM.
22nd Oct 2018, 5:53 AM
Kirk Schafer
Kirk Schafer - avatar
+ 3
Normally you can't print characters that don't belongs to extended ascii table. In this table some characters like α or β appears so they are printable. The characters that you are having difficult to print just don't belongs the table. Note: I know this is not a solution. It's just a explanation
22nd Oct 2018, 12:50 AM
Anya
Anya - avatar
+ 3
It looks like the sololearn C# backend is not unicode-ready. You shouldn't have to do anything special to print unicode characters in C#, but it looks like somewhere in transmission some encoding slip-up happens. You should probably send your issue to info@sololearn.com for review! I'm sure the devs will take a look at it.
22nd Oct 2018, 2:30 AM
Schindlabua
Schindlabua - avatar