Converting EML to DXL how to use HTML Body Part properly

I’m writing an exe which converts EML files from the SMTP drop folder to notes documents and then to DXL files.

This is primarily for a Chinese client. I’m using the IMessage interface provided by Microsoft to read the EML file and get the various fields (like To, CC, Subject, Text Body, HTML Body etc).

In the new note which i create the for the notes mail, i am able to add the To, CC and Subject without any loss of chinese characters. For this i’m using OSTranslate to convert the buffer to LMBCS and then pass it to NSFItemSetText.

However to maintain formatting and other embedded objects, i need to handle HTML body part too. For this currently i’m importing the HTML into a composite data into a file (using the lgimport sample C API program). Then i’m creating a buffer with paras and then writing this buffer along with the file contents to the notes document using the NSFItemAppend API with the Type as TYPE_COMPOSITE. However the HTML Body is getting screwed and is not displayed properly.

Does anyone know how to move an HTML body from EML to notes document?

Please let me know.

Thanks.