 
   defp truncate_n(binary, n) when is_binary(binary) do
     remaining = n - byte_size(binary)
+
     if remaining < 0 do
       # There is a chance we are cutting at the wrong
       # place so we need to fix the binary.

    %{args: args, width: width, strings: strings?} = spec

    opts = %{
      opts |
      charlists: inspect_charlists(strings?, opts),
      limit: inspect_limit(char, args, opts),
      width: inspect_width(char, width),
    }

    %{@inspected_format_spec | args: [inspect_data(args, opts)]}
  end
  defp handle_format_spec(spec, _opts), do: spec

  defp inspect_charlists(false, _), do: :as_lists

    end
  end

  defp truncate_n(int, n) when int in 0..127, do: {int, n - 1}
  defp truncate_n(int, n) when int in 127..0x07FF, do: {int, n - 2}
  defp truncate_n(int, n) when int in 0x800..0xFFFF, do: {int, n - 3}
  defp truncate_n(int, n) when int >= 0x10000 and is_integer(int), do: {int, n - 4}

  defp truncate_n(list, n) when is_list(list) do
