Does anyone have a PeopleCode algorithm for hex encoding strings? I'm working on an
escapeJSON function and would like to come up with a good way to convert unsafe characters to unicode. Here is what I've come up with, but I would like to hear other ideas:
Local JavaObject &int = GetJavaClass("java.lang.Integer");
Local string &unicode;
REM ** I hard coded the source character to A for this example;
&unicode = "\u" | Right("0000" | &int.toHexString(Code("A")), 4);
This converts "A" to \u0041. The actual Hex part is
I don't think there is anything wrong with my solution. I am just wondering if I overlooked some PeopleCode function for displaying numbers in Hex.