Skip to content

Instantly share code, notes, and snippets.

@masuidrive
Created January 7, 2009 17:17
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/44342 to your computer and use it in GitHub Desktop.
Save masuidrive/44342 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 = "うまく表示してね!".kconv(Kconv::EUC, Kconv::SJIS)
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