Additional/special characters when streaming blobs in/out

Rob_HansenRob_Hansen Member Posts: 296
edited 2013-01-29 in NAV Three Tier
Has anyone encountered issues with NAV adding extra (special / non-standard) characters at the start of text streamed in/out of BLOB fields? I'm doing work in NAV 2013 streaming out of BLOBs to text files and then streaming them back in (after the user makes changes) and one or two extra characters are appearing at the start of the files. It's somewhat random as it doesn't happen every time. I've also had strange cases where spaces are inserted between each character without explanation (on the first run, the extra spaces show up...on the next run, they don't...with the same code).

Has anyone encountered any issues along those lines with text streams? I've tried using both COPYSTREAM, as well as manually reading/writing each character out, with the same results.

Comments

  • ara3nara3n Member Posts: 9,256
    The file that you are importing is probably in different encoding. It could be in unicode UTF8 or UTF16.

    Take a look at this post on how to import the files.

    http://blogs.msdn.com/b/nav/archive/201 ... gle+Reader
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • Rob_HansenRob_Hansen Member Posts: 296
    These are files that are initially created by NAV where i'm writing out the content. When the BLOB is initially empty, i'm creating an empty text file and opening it with notepad for the user to edit. Then when the user closes notepad I open the file and stream it back into the blob. I've tried multiple different approaches here...directly using COPYSTREAM, using OStream.WRITE to transfer it character by character, and transferring it to text variables first and then reading/writing. The extra characters still show up, but as I said it's not every time. Sometimes when I stream out the text, it even adds a space between every character.

    This one's driving me nuts...I guess i'll go to Microsoft with it as it seems buggy.
  • Rob_HansenRob_Hansen Member Posts: 296
    This one's interesting. I switched my code to use the .net StreamWriter, set to ASCII encoding...and it works without any extra/special characters. The only change I made in my code was to switch the line that previously used the Write method of the NAV outstream object to instead use the .net object write method...and everything works great.

    Has anyone else had issues with the NAV outstream and extra characters showing up?

    (I'm still using the NAV instream for the read side, and i'm still creating a NAV outstream...i'm just now using the streamwriter Write function instead of OStream.Write)
Sign In or Register to comment.