Maybe you're (inadvertently) making a caricature by using a simple "what time is it?" question but many user questions are under-specified.
Because of that, Stackoverflow answerers in particular do go into the extra complexities because it's part of its editorial DNA to restate the q&a so it's a high-quality community knowledgebase instead of just answering the direct question as stated. I tried to explain this hard-to-grasp nuance previously: https://news.ycombinator.com/item?id=21115438
But sometimes, this X-Y problem editorializing mechanism gets so enthusiastic that it can detract from a correct answer. Here's a famous example of a string bytes extraction question with smart people arguing with the correct answers from user541686 (was Mehrdad) and Michael Buen:
+ correct answer has lots of X-Y pushback in the comments: https://stackoverflow.com/questions/472906/how-do-i-get-a-co...
+ another correct answer from Buen that emphasizes user541686/Mehrdad works for broken unpaired surrogates: https://stackoverflow.com/questions/472906/how-do-i-get-a-co...
The meta layer issue is that the question is underspecified which causes 2 sides with very intelligent people arguing whether or not it's an X-Y problem!
So, the solution works, but only in specific situations which are not clearly explained and might be totally unrelated from OP's situation, and furthermore it doesn't really address the second part of OP's question "why take encoding into consideration?" I wouldn't necessarily call the problems with that answer just "XY pushback".