UTF8 is not a code page, and since code pages only make sense for ANSI functions, you cannot do what you ask for.
If you want to save the string as UTF8, you will need to convert from ANSI your application to unicode (wide char) using MultiByteToWideChar() , and then use WideCharToMultiByte() to convert to UTF8.
Alternatively, update the application to use the internal unicode / wide line and convert as needed.
source share