Transform LS String back to UTF-8 characters

Hi forum,

when I fetch the contenct of an UTF-8 coded (encoding=“UTF-8”) xml file via API calls to wininet.dll - I got the result in a LotusScript String variable (Unicode?).

After assining the content of that string to a text-field in a Notes Document, there are incorrect characters like ü (which should be the German Umlaut ä) when viewing the resulting document in the Notes Client.

The XML content is read via calls to:

Declare Function InternetReadFile Lib “wininet.dll” (Byval hFile As Long, Byval sBuffer As String, Byval lNumBytesToRead As Long, lNumberOfBytesRead As Long) As Integer

The content of ‘sBuffer’ is assigend to the LotusScript string. Using ‘Byval sBuffer As Lmbcs String’ in the Declaration does not help.

It seems that LS does some modification of the xml code (UTF-8) by its own when storing the data in the LS String variable.

Is there any way to transform the LS String back to real UTF-8 characters bevor storing it in the text field in a Notes document?

Or a way to replace the wrong characters within the LS String variable?

Thank you for your help!

Regards,

Manfred

Subject: Transform LS String back to UTF-8 characters

I don’t know if Rob Whiteley’s example code at:

http://www-10.lotus.com/ldd/46dom.nsf/c21908baf7e06eb085256a39006eae9f/28040d8a5c1f06ac80256de40068c328?OpenDocument

will help.

Looks like you have got UTF-8 in your string, but this isn’t getting translated in memory to LMBCS. i.e. LS doesn’t know it is UTF-8 it is looking at.

Personally I find xml and string translation a lot less painful in Java.

HTH - Rufus.

Subject: RE: Transform LS String back to UTF-8 characters

Rufus,

thanks for your answer. I will take a deeper look into Rob’s sample code.

Regards,

Manfred