embed some functions from the xmerl module in erlang-idna

copy the functions from the xmerl_ucs module to avoid to depends on it
just for it.