Downloadfile and text files

Discussion in 'Questions (Windows Mobile)' started by N1c0_ds, Oct 16, 2008.

  1. N1c0_ds

    N1c0_ds Active Member Licensed User

    I tried using downloadfile to retrieve CSV and text files and they are rendered unusable when downloaded to the device.

    They turn from this:
    Hello
    This is a test

    To this:
    Hello[]This is a test

    The line breaks get replaced with rectangle characters (unknown character) and it renders the file useless.

    Is there a fix to this?
     
  2. Cableguy

    Cableguy Expert Licensed User

    You could search the returned string and replace all the "[]" by "crlf"...

    Something like
    newstring=StrReplace (oldstring,"[]","crlf")
     
  3. agraham

    agraham Expert Licensed User

    Do you mean this http://www.basic4ppc.com/forum/questions-help-needed/2157-download-files.html

    How are you displaying the file when you are seeing those rectangular characters? Rectangular boxes are unprintable characters. You can check what they are by
    Code:
    nstr = ""
    For i = 0 to Strlen(Str) - 1
      nstr = nstr & 
    Asc(StrAt(Str, i) & " "
    Next
    Msgbox(nstr)
    A line break should be 13 (Cr) followed by 10 (Lf)
     
  4. N1c0_ds

    N1c0_ds Active Member Licensed User

    I found the solution!

    The unknown character is chr(10). You have to replace it with chr(13) & chr(10) usung StrReplace.

    Thanks for your help!
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice