lib/bolt/container_result.rb
# This is the value with all non-UTF-8 characters removed, suitable for
# printing or converting to JSON. It *should* only be possible to have
# non-UTF-8 characters in stdout/stderr keys as they are not allowed from
# tasks but we scrub the whole thing just in case.
This is the value with all non-UTF-8 characters removed, suitable for
printing or converting to JSON. It *should* only be possible to have
non-UTF-8 characters in stdout/stderr keys as they are not allowed from
tasks but we scrub the whole thing just in case.
This is the value with all non - UTF - 8 characters removed suitable for printing or converting to JSON . It * should * only be possible to have non - UTF - 8 characters in stdout / stderr keys as they are not allowed from tasks but we scrub the whole thing just in case .
def safe_value
      Bolt::Util.walk_vals(value) do |val|
        if val.is_a?(String)
          val.scrub { |c| c.bytes.map { |b| "\\x" + b.to_s(16).upcase }.join }
        else
          val
        end
      end
    end
def safe_value Bolt :: Util . walk_vals ( value ) do | val | if val . is_a? ( String ) val . scrub { | c | c . bytes . map { | b | "\\x" + b . to_s ( 16 ) . upcase } . join } else val end end end
This is the value with all non-UTF-8 characters removed, suitable for
printing or converting to JSON.
This is the value with all non - UTF - 8 characters removed suitable for printing or converting to JSON .
# Replace invalid bytes with hex codes, ie. \xDE\xAD\xBE\xEF