function unicode_reverse(string utf8) sequence utf32 = utf8_to_utf32(utf8) integer ch -- the assumption is made that -- and etc would work the same. for i=1 to length(utf32) do ch = utf32[i] if (ch>=0x300 and ch<=0x36f) or (ch>=0x1dc0 and ch<=0x1dff) or (ch>=0x20d0 and ch<=0x20ff) or (ch>=0xfe20 and ch<=0xfe2f) then utf32[i] = utf32[i-1] utf32[i-1] = ch end if end for utf32 = reverse(utf32) utf8 = utf32_to_utf8(utf32) return utf8 end function