Results 1 to 9 of 9

Thread: Dejavu data filling up cCjGrid

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #8
    Join Date
    Feb 2009
    Location
    The Netherlands
    Posts
    4,674

    Default Re: Dejavu data filling up cCjGrid

    Ideally every piece of software would interpret every string the same. But if the Unicode project has learned me one thing, it is that that is not true. DataFlex allows 0 bytes inside a string. To do this internally it stores the string size in front of the string and uses this to determine how many bytes need to be copied / moved when passing strings around. It also puts a 0 terminator at the end of each string so you can still use external functions that work with 0 terminated strings and call them by passing AddressOf(sString).

    Now most windows API's work with 0 terminated strings, so they do not support 0 bytes inside a string and interpret these as the terminator. ShowLn likely uses an API that does this, and is just one of many examples. A lot of the string functions can't handle 0 bytes inside strings as well.

    Proper text strings should not contain 0 bytes. The reason that DataFlex supports this is to allow you to use strings for working with binary data in memory. Before we had the UChar array, this was the only alternative to using Alloc and Free to handle non textual data in memory.

    This all applies to previous versions of DataFlex as well but DataFlex 2021 just got a little more picky because of unicode. A lot of string functions like Mid now count UTF-8 characters instead of directly using its parameters as byte offsets. The debugger now uses different API's to convert and display strings, so it likely displays strings with binary (non textual) data differently. Hence our recommendation to use UChar arrays for (non textual) binary data.

    Note that I am actually surprised by CodeJock displaying data past the 0 terminator, but the unicode project keeps suprising me...
    Last edited by Harm Wibier; 6-Jan-2021 at 07:43 AM.

Posting Permissions

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