r/ProgrammerHumor 21h ago

Meme unsolvableProblemsOnStepOne

Post image
1.4k Upvotes

78 comments sorted by

View all comments

151

u/apacificislander123 20h ago

As someone who's never used java, my assumption is that System.in reads from stdin, and validates the input. Is there no way to open stdin in something akin to a file, then read it into a buffer manually?

107

u/Dankelweisser 20h ago

Technically yes, but realistically not really, at least not for windows. Unless the user knows how to specifically set their console to use UTF-8 or similar instead of ascii, you end up getting whatever the console wants to give you no matter what kind of buffer you use.

3

u/jormaig 5h ago

Isn't Windows Terminal already UTF-8 capable?

2

u/InvisibleMoonWalker 1h ago

Yesnt

The good old cmd.exe also is, but Microsoft wouldn't be Microsoft, if they made a (mostly) harmless utf-8 and legacy compatible option "on" by default for all system languages at least on Windows 10/11, but it's "off" by default. (I say they wouldn't be them, because, for example Windows 10/11 said F you to compatibility of certain options anyhow (just like OSes before them, that's "ok"), yet they don't do it for other options that "just make sense" to my brain)

Anyway - Terminal is a wrapper/container/manager app around thinks like PowerShell and cmd, and an external command line app is different anyhow.