Sha256: b513b0503db6fb09999fd130869e63d1045a0fe6fdf3b040ebcd60553a694861

Contents?: true

Size: 678 Bytes

Versions: 15

Compression:

Stored size: 678 Bytes

Contents

module CanvasOauth
  # We get into a weird case with the CDN with canvas where the Content-Type for a CSV comes back as text/csv, but there
  # is no associated charset with it. HTTParty will default to treating it as binary (aka ASCII-8BIT) data which causes
  # issues downstream when the data gets combined with local application data. In cases where we can reasonably know
  # it'll be a UTF-8 compatible file (i.e any csv file from canvas) we'll force an encoding of UTF-8 if ruby thinks its
  # ASCII-8BIT
  class DefaultUTF8Parser < HTTParty::Parser
    def parse
      body.force_encoding("UTF-8") if body&.encoding == Encoding::ASCII_8BIT
      super
    end
  end
end

Version data entries

15 entries across 15 versions & 2 rubygems

Version Path
canvas_oauth_engine-2.4.0 lib/canvas_oauth/default_utf8_parser.rb
canvas_oauth_engine-2.3.0 lib/canvas_oauth/default_utf8_parser.rb
canvas_oauth_engine-2.2.0 lib/canvas_oauth/default_utf8_parser.rb
qalam_oauth_engine-3.0.9 lib/canvas_oauth/default_utf8_parser.rb
qalam_oauth_engine-3.0.8 lib/canvas_oauth/default_utf8_parser.rb
qalam_oauth_engine-3.0.7 lib/canvas_oauth/default_utf8_parser.rb
qalam_oauth_engine-3.0.6 lib/canvas_oauth/default_utf8_parser.rb
qalam_oauth_engine-3.0.5 lib/canvas_oauth/default_utf8_parser.rb
qalam_oauth_engine-3.0.4 lib/canvas_oauth/default_utf8_parser.rb
qalam_oauth_engine-3.0.3 lib/canvas_oauth/default_utf8_parser.rb
qalam_oauth_engine-3.0.2 lib/canvas_oauth/default_utf8_parser.rb
qalam_oauth_engine-3.0.1 lib/canvas_oauth/default_utf8_parser.rb
qalam_oauth_engine-3.0.0 lib/canvas_oauth/default_utf8_parser.rb
qalam_oauth_engine-2.2.9 lib/canvas_oauth/default_utf8_parser.rb
canvas_oauth_engine-2.1.3 lib/canvas_oauth/default_utf8_parser.rb