# File lib/rbreadline.rb, line 6450
  def fnprint(to_print)
    printed_len = 0

    case @encoding
    when 'E'
      arr = to_print.scan(/./me)
    when 'S'
      arr = to_print.scan(/./ms)
    when 'U'
      arr = to_print.scan(/./mu)
    when 'X'
      arr = to_print.dup.force_encoding(@encoding_name).chars
    else
      arr = to_print.scan(/./m)
    end

    arr.each do |s|
      if(ctrl_char(s))
        @rl_outstream.write('^'+(s[0].ord|0x40).chr.upcase)
        printed_len += 2
      elsif s == RUBOUT
        @rl_outstream.write('^?')
        printed_len += 2
      else
        @rl_outstream.write(s)
        if @encoding=='U'
          printed_len += s.unpack('U').first >= 0x1000 ? 2 : 1
        elsif @encoding=='X'
          printed_len += s.ord >= 0x1000 ? 2 : 1
        else
          printed_len += s.length
        end
      end

    end

    printed_len
  end