#!/usr/bin/env ruby
# -*- coding: utf-8 -*-

utf8 = "やばたにえん"
pp utf8.encoding

utf8 = "やばたにえん"
sjis = utf8.force_encoding(Encoding::SJIS)

pp sjis.encoding

pp utf8.bytes == sjis.bytes

utf8 = "やばたにえん"
sjis = utf8.force_encoding(Encoding::SJIS)

pp sjis.encode(Encoding::UTF_8,invalid: :replace, undef: :replace)
