function p._removeaccents(rv)
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	return rv
end

function p.removeaccents(frame)
	local rv = mw.ustring.toNFC (frame.args[1])
	-- if (true) then return mw.ustring.isutf8 (rv) end
	return p._removeaccents(rv)
end

--

The next function returns a % encoding concomitant with ISO/IEC 8859-1. It encodes % and any non-reserved and non-unreserved
characters.

Space is currently encoded as an underscore.

Reserved characters are currently not encoded.


function p.urlencodeISO88591(frame)
	local rv = mw.ustring.toNFC (frame.args[1])
	
	-- % first to avoid double encoding
	rv = mw.ustring.gsub
	
	-- space to underscore, then punctuation which is not reserved
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub -- quote mark
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub -- backslash does not work with "\092", "%\" or "\"
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	
	-- all the rest of the codepoints that are printable
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	rv = mw.ustring.gsub
	return rv
end