1
0
-1

Hi all,

Short of writing a 3gl function to do this.....

I'm processing a number of txt files - and every now and then I come across a control character

which causes good ol' Uniface to have a hissy fit.

The control character in question is HEX 0x1a - Ascii 26. 

I've tried a $replace in combination with $tometa (result in a $2) - no joy..

Any other ideas out there?


Knut

    CommentAdd your comment...

    6 answers

    1.  
      2
      1
      0

      Changing the snippet to encode the string as URAW also gives the correct result for characters   

      trigger detail
      	variables
      		string e, s, z, r
      		raw c 
      	endvariables
      
      	r = "-X-"
      	for $n$ = 0 to 255
      		z = "&#%%$n$%%%;"
      		c = $encode("URAW", $string(z))
      		s = $concat("A...", c, "...Z")
      		s = $replace(s, 1, c, r, -1)
      		putmess "%%z : %%s"
      	endfor
      end
      1. Knut Dybendahl

        Hi Mike,

        This threw me for a loop for quite some time...

        Until - doing a fileload/raw, $replace, filedump/raw which finally fixed the darn control character.

        Thanking you!

      CommentAdd your comment...
    2.  
      1
      0
      -1

      Hi all,

      Nasty solution, but do you try to input the character "26" directly in $replace.

      like $replace(buffer,1,"→" ,"",-1)

      → : alt+numpad 26.



        CommentAdd your comment...
      1.  
        1
        0
        -1

        Are there much more undocumented Features in Uniface like $tometa???

        Can't find anything in Uniface Documentation about $tometa!!!


        Take a sample program:

        numeric dis(9999) n


        variables
         string c, e, s, z, r
        endvariables
        r = "-X-"
        for $n$ = 0 to 255
         z = "&#%%$n$%%%;"
         c = $string(z)
         s = $concat("A...", c, "...Z")
         s = $replace(s, 1, c, r, -1)
         putmess "%%z : %%s"
        endfor


         : A......Z

         : A...-X-...Z

         : A......Z


        $replace will replace all characters but  and 

        That's not really nice UNIFACE!

        Please STOP this!!!


        Norbert

          CommentAdd your comment...
        1.  
          1
          0
          -1

          processing a list created from comma separated line items ==> internal UF infinite loop - 100% cpu usage.

            CommentAdd your comment...
          1.  
            1
            0
            -1

            Out of curiosity, what kind of hissy fit? 

              CommentAdd your comment...