I tried doing a bit of research on this, but it's not a strong area of mine. I know there's a solution, since AutoHotkey_L appears to handle supplemental plane and surrogates just fine, and even specifically with PCRE. There's a lot of WideCharToMultiByte / MultiByteToWideChar function use.
https://github.com/Lexikos/AutoHotkey_L/search?q=WideCharToMultiBytehttps://github.com/Lexikos/AutoHotkey_L/search?q=surrogatehttps://github.com/Lexikos/AutoHotkey_L/search?q=0x10FFFF...might be able to give you some ideas, anyway. AHK does a lot of what mSL attempts to do.
Example:
https://github.com/Lexikos/AutoHotkey_L/..._ord2utf8.c#L41/* This file contains a private PCRE function that converts an ordinal character value into a UTF8 string. */