Skip to content

Instantly share code, notes, and snippets.

@masuidrive
Created January 7, 2009 17:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save masuidrive/44343 to your computer and use it in GitHub Desktop.
Save masuidrive/44343 to your computer and use it in GitHub Desktop.
require 'kconv'
require 'iconv'
require 'nkf'
require 'test/unit'
class GuessEncoding < Test::Unit::TestCase
def setup
# EUC-JP encoded うまく表示してね!
@euc = "¥345¥341¥254¥345¥242¥300¥345¥341¥276¥352¥241¥243¥245¥243¥356¥246¥245¥263¥345¥341¥316¥345¥242¥250¥345¥341¥245¥345¥376¥276"
end
def test_guess_encoding
tmp = NKF.guess(@euc)
# enc = NKF.constants.find { |c| NKF.const_get(c) == tmp }
assert_equal NKF::EUC, tmp
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment