module AoBane::EncodingType
Constants
- ASCII
- EUC
- EUCJP
- SHIFT_JIS
- SJIS
- US_ASCII
- UTF8
- UTF_8
Public Class Methods
convert_to_charset(str_value)
click to toggle source
# File lib/AoBane.rb, line 155 def self.convert_to_charset(str_value) type = self.regulate(str_value) case type when EUC 'euc-jp' when SJIS 'shift_jis' when UTF8 'utf-8' when ASCII nil end end
convert_to_kcode(str_value)
click to toggle source
# File lib/AoBane.rb, line 144 def self.convert_to_kcode(str_value) type = self.regulate(str_value) case type when EUC, SJIS, UTF8 type when ASCII 'none' end end
regulate(str_value)
click to toggle source
# File lib/AoBane.rb, line 129 def self.regulate(str_value) case str_value.downcase when 'shift-jis', 'shift_jis' SJIS when 'euc-jp' EUC when 'utf-8' UTF8 when 'ascii' ASCII else raise EncodingError, "not adapted encoding type - #{str_value} (shift[-_]jis, euc-jp, utf-8, or ascii)" end end