FORUM PLAN UPDATE: Date revision: This forum will remain open to new posts and responses until December 1, 2018. (After that date, you will still be able to view and search the forum.) Also, we're taking a second look at the best place to host future conversation. For now, keep using this forum, and stay tuned for more news.
FWIW, here's a working solution that uses a NotesStream object.
Below is a Function that uses a NotesStream object to perform the conversion. The trick is to supply "LMBCS" for the charset parameter to NotesStream.Open() when writing to the stream. Note that "LMBCS" is an undocumented keyword not mentioned in Designer Help (as of 8.5.3). Yet I'm quite confident that it will continue to be supported in future versions of Notes, given that LMBCS is the native character set of Notes.
'/** ' * Function converts a LotusScript string by interpreting it as if it were UTF-8. ' * @param rText references a LotusScript string to be interpreted as UTF-8. ' * @param rFilePath specifies the complete path to a temporary file to use for the conversion. ' * @return a string that is obtained by decoding the sequence of bytes contained in <code>rText</code> using UTF-8. ' * @error 75 (ErrPathFileAccessError) if writing to <code>rFilePath</code> fails. ' */ Function Convert(rText AsString, rFilePath AsString) AsString Dim sn AsNew NotesSession() Dim ns As NotesStream IfDir$(rFilePath) <> ""ThenKill rFilePath Set ns = sn.CreateStream() Call ns.Open(rFilePath, "LMBCS") Call ns.WriteText(rText) Call ns.Close() Call ns.Open(rFilePath, "UTF-8")
Convert = ns.ReadText() Call ns.Close() EndFunction