-
encoding problem
i'm converting a string ,letter by letter into ascii codes, adding 3 to each ascii code and converting them back into string.
so "hello" would become "khoor"
Im saving this to a textfile.
The problem is that when im reading it back from the textfile and converting it back to the original string the code puts two little squares after it.
Dim fso As New FileSystemObject
Dim s, stext As String
Dim objTextStream
ArticleText.Text = ""
s = Data.Files(1)
Set objTextStream = fso.OpenTextFile(s, 1)
stext = objTextStream.ReadAll
so my stext has two squares at the end :0(
does anyone know why?
thanks
kati
-
Re: encoding problem
I am not positive. But, I believe the last 2 squares are the EOF (end-of-file) marker or possibly a carriage return/linefeed (vbCrLf) maybe.
Hope that helps :wave:
-
Re: encoding problem
thanks.
any idea how to get rid of them?
trim() doesnt work
thanks
Kati
-
Re: encoding problem
You can easily chop off the last 2 chars as such:
Debug.Print Left(sText, Len(sText) - 2)
That funky char might be treated as 1 char though, its been a while since I dealt with it. Just change to - 1 instead if that is the case. Good luck.