Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

special characters not correct when reading/writing as textstreamfile

Status
Not open for further replies.

ThinLizzy

Programmer
May 30, 2002
12
NL
Hello,

I have a Word file which I want to read line by line.
First I save the file as text-file.
Then I read this text-file and write it as a new file.

THE PROBLEM: Special characters like "é" are not translated
correct (in this case "é" is translated as ",").



This is the code:

Set ObjXRead=CreateObject("Scripting.FileSystemObject"). _
GetFile(strTempPad & strFileRead). _
OpenAsTextStream(1, 0)

Set ObjXWrite=CreateObject("Scripting.FileSystemObject"). _
createtextfile(strTempPad & strFileWrite). _
GetFile(strTempPad & strFileWrite)

Do While Not ObjXRead.AtEndOfStream

strLine = ObjXRead.ReadLine

strLine = DoSomeThingWithLine(strLine)

ObjXWrite.WriteLine strLine

.....


Please some help.
 
I think that I might try opening both files using UNICODE, rather than ASCII.

Set ObjXRead=CreateObject("Scripting.FileSystemObject"). _
GetFile(strTempPad & strFileRead). _
OpenAsTextStream(1, TristateTrue)

Set ObjXWrite=CreateObject("Scripting.FileSystemObject"). _
createtextfile(strTempPad & strFileWrite, False, True). _
GetFile(strTempPad & strFileWrite)
Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein


 
Thanks for your reaction.

The Problem was that I did a .SaveAs with the
Word document. The FileFormat which I
used was the wrong one (wdFormatDOSTextLineBreaks).
When I used FileFormat:=wdFormatTextLineBreaks the
problem was gone.
So it wasn't the code i mentioned above,

Thanks anyway.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top