File: encoding_helpers.rb

package info (click to toggle)
ruby-prawn 2.5.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 4,528 kB
  • sloc: ruby: 17,688; sh: 43; makefile: 20
file content (14 lines) | stat: -rw-r--r-- 340 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
# frozen_string_literal: true

# String encoding helpers.
module EncodingHelpers
  # Make sure the string is Windows-1252 -encoded.
  def win1252_string(str)
    str.dup.force_encoding(Encoding::Windows_1252)
  end

  # Make sure the string is binary-encoded
  def bin_string(str)
    str.dup.force_encoding(Encoding::ASCII_8BIT)
  end
end