How many more bytes should be allocated for CSV escaping ?

Property definitions

csv :: csv $ Text :: chars_to_escape_csv
	# How many more bytes should be allocated for CSV escaping ?
	private fun chars_to_escape_csv(sep_char, delim_char: Char, eol: String): Int do
		var more_ln = 0
		var ln = length
		var need_esc = false
		var fst_eol = eol.first
		var i = 0
		while i < ln do
			var c = self[i]
			if c == delim_char then more_ln += 1
			if c == fst_eol then
				need_esc = true
				for j in [1 .. eol.length[ do
					i += 1
					c = self[i]
					if c != eol[j] then
						i -= j
						need_esc = false
						break
					end
				end
			end
			if c == sep_char then need_esc = true
			i += 1
		end
		var more = more_ln * delim_char.u8char_len
		if need_esc then more += 2
		return more
	end
lib/csv/csv.nit:36,2--64,4