Ruby なら、NKF モジュールで、文字コードを推測できるけど、
Windows では、NKFを使っていないのかも

require 'nkf'

NKF.guess "北斗の拳"
#=> #<Encoding:UTF-8>