I need a Classic ASP function that will take a string such as Jämshög
and convert it to J\u00e4msh\u00f6g
so that all the accented characters become their equivalent unicode escape codes.
I am sending this data in a JSON string to an API that requires all special characters to use unicode escape codes.
I've been searching for what seems like hours to come up with a solution and I haven't managed to come close. Any help would be greatly appreciated.
Take a look at the function from aspjson below. It also handles non-unicode characters that must to be escaped such as quote, tab, line-feed etc. Luckily no dependencies, so works stand-alone too.