Additional info: I went through my .emacs and was able to find out when the corrupted output occurs, it happens whenever I have
'(current-language-environment "Turkish")
'(default-input-method "turkish-postfix")
enabled. If I turn those two settings off, no problem. I tried to summarize the situation further below.