Class: AudioTag::ID3::V2::TextDecoder
- Inherits:
-
Object
- Object
- AudioTag::ID3::V2::TextDecoder
- Defined in:
- lib/audio_tag/id3/v2/text_decoder.rb
Constant Summary collapse
- ENCODINGS =
{ ascii: /^\x00(.*?)(\x00)?$/, utf_16: /^\x01(.*?)(\x00\x00)?$/, utf_16be: /^\x02(.*?)(\x00\x00)?$/, utf_8: /^\x03(.*?)(\x00)?$/ }.freeze
Class Method Summary collapse
Class Method Details
.decode(string) ⇒ Object
21 22 23 24 25 26 27 28 29 |
# File 'lib/audio_tag/id3/v2/text_decoder.rb', line 21 def self.decode(string) case encoding(string) when :ascii then string.gsub(ENCODINGS[:ascii], "\\1") when :utf_16 then string.gsub(ENCODINGS[:utf_16], "\\1") when :utf_16be then string.gsub(ENCODINGS[:utf_16be], "\\1") when :utf_8 then string.gsub(ENCODINGS[:utf_8], "\\1") else string end end |