fix memory leak in utf8 upper/lower usage, factor out (but do not yet change) conversions between internal (CESU-8) and external (UTF-8) string representations