OberonPlace.com Forums

OberonPlace.com Forums (http://forum.oberonplace.com/index.php)
-   CorelDRAW/Corel DESIGNER VBA (http://forum.oberonplace.com/forumdisplay.php?f=16)
-   -   Save file with unicode characters (http://forum.oberonplace.com/showthread.php?t=24838)

default.user 05-09-2019 01:52

Save file with unicode characters

I've been browsing the forum and the very few other corel VBA related pages in the internet, but I did not find a solution to save and load text as unicode.
My script collects a lot of information in various languages from a large document and when it saves it using

Print #1, "unicode text
all special characters are replaced by '?'
When I switch over to the file object method

objTextStream.WriteLine "unicode text"
The whole line disappears, as soon as it consists of a single special character.

Does anybody have a solution to share ?

Thank you !

default.user 05-09-2019 04:09

Problem is way more complex as I thought
So, I found an other code fragment from an other website.

Dim fsT As Object
  Set fsT = CreateObject("ADODB.Stream")
  fsT.Type = 2
  fsT.CharSet = "utf-8"
  fsT.WriteText t.Text.Story & Chr(10)
  fsT.SaveToFile "c:\temp\fst.txt", 2

I was able to proof this fragment to write special characters when I replace t.Text.Story by 'Ø22'; so I assume that »objTextStream.WriteLine "unicode text"« already did the job as well.
But my real code still does not export special characters, so I've been adding a MessageBox to verify the string before it is written and surprise surprise – the text that is displayed is already wrong !

MsgBox (t.Text.Story)
fsT.WriteText t.Text.Story & Chr(10)

The MessageBox shows '?22' - but the text was 'Ø22' !

Is Corel VBA not compatible to it's own internal data structure, or what went wrong ?

Any help would be much appreciated !
Thank you.

All times are GMT -5. The time now is 17:21.

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright © 2011, Oberonplace.com