class String

Public Instance Methods

AsciiToUtf8() click to toggle source
# File lib/virt_disk/disk_unicode.rb, line 20
def AsciiToUtf8
  dup.force_encoding("ISO-8859-1").encode("UTF-8")
end
AsciiToUtf8!() click to toggle source
# File lib/virt_disk/disk_unicode.rb, line 24
def AsciiToUtf8!
  force_encoding("ISO-8859-1").encode!("UTF-8")
end
Ucs2ToAscii() click to toggle source
# File lib/virt_disk/disk_unicode.rb, line 36
def Ucs2ToAscii
  dup.force_encoding("UTF-16LE").encode("ISO-8859-1")
end
Ucs2ToAscii!() click to toggle source
# File lib/virt_disk/disk_unicode.rb, line 40
def Ucs2ToAscii!
  force_encoding("UTF-16LE").encode!("ISO-8859-1")
end
UnicodeToUtf8() click to toggle source

See Programming Ruby 1.9 - The Pragmatic Programmers’ Guide Figure 17.1. “Encodings and Their Aliases” in the for available encodings.

# File lib/virt_disk/disk_unicode.rb, line 4
def UnicodeToUtf8
  dup.force_encoding("UTF-16LE").encode("UTF-8")
end
UnicodeToUtf8!() click to toggle source
# File lib/virt_disk/disk_unicode.rb, line 8
def UnicodeToUtf8!
  force_encoding("UTF-16LE").encode!("UTF-8")
end
Utf8ToAscii() click to toggle source
# File lib/virt_disk/disk_unicode.rb, line 28
def Utf8ToAscii
  dup.force_encoding("UTF-8").encode("ISO-8859-1")
end
Utf8ToAscii!() click to toggle source
# File lib/virt_disk/disk_unicode.rb, line 32
def Utf8ToAscii!
  force_encoding("UTF-8").encode!("ISO-8859-1")
end
Utf8ToUnicode() click to toggle source
# File lib/virt_disk/disk_unicode.rb, line 12
def Utf8ToUnicode
  dup.force_encoding("UTF-8").encode("UTF-16LE")
end
Utf8ToUnicode!() click to toggle source
# File lib/virt_disk/disk_unicode.rb, line 16
def Utf8ToUnicode!
  force_encoding("UTF-8").encode!("UTF-16LE")
end