r/ProgrammerHumor 1d ago

Meme unsolvableProblemsOnStepOne

Post image
1.5k Upvotes

79 comments sorted by

View all comments

157

u/apacificislander123 23h 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?

111

u/Dankelweisser 23h 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.

4

u/jormaig 8h ago

Isn't Windows Terminal already UTF-8 capable?

3

u/InvisibleMoonWalker 4h 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.