My problem stems from Emacs inserting the coding system headers into source files containing non-ascii characters:
# -*- coding: utf-8 -*-
My c
This works for me:
(setq ruby-insert-encoding-magic-comment nil)
As suggested here
I believe you're correct that it only happens in ruby-mode. It seems ruby-mode is trying to be helpful by adding the line, which makes Ruby detect the source file encoding automatically.