Results 1 to 4 of 4

Thread: encoding problem

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Mar 2005
    Posts
    107

    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

  2. #2
    Junior Member
    Join Date
    May 2005
    Location
    Litchfield, IL
    Posts
    22

    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
    - ILJester

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Mar 2005
    Posts
    107

    Re: encoding problem

    thanks.

    any idea how to get rid of them?


    trim() doesnt work


    thanks


    Kati

  4. #4
    Junior Member
    Join Date
    May 2005
    Location
    Litchfield, IL
    Posts
    22

    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.
    - ILJester

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width