Announcement

Collapse
No announcement yet.

Unicode characters. I can print them on screen but can I......

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Unicode characters. I can print them on screen but can I......

    Hello all,

    Soooo I have a couple of questions about unicode characters. I am able to print them using the printdisk and getting the strings from a txf file. I was wondering instead of getting the chars from a file is it possible to type them in the workshop4 environment? When for instance I type Russian characters, I can see them when I type them but I only get ????? on my LCD. Saving the file and reopening it and the characters are replaced with ?????? . I guess it has to do with the formating in which the file is saved. Is there a way around it? Also instead of printing the character (ch) directly to the LCD, is there a way to store it to a string array? I tried something like this but obviously failed

    Code:
    var uniCodeDest[20];
    
    func PrintDiskUnicode2(var hndl, var offsh, var offsl, var msglen, var msgid)
        var ch, offs32[2], res32[2];
        umul_1616(offs32, msglen, msgid);
        res32[1] := offsh ;
        res32[0] := offsl ;
        uadd_3232(res32,res32,offs32) ;
        file_Seek(hndl, res32[1], res32[0]);
        var enummer:=0;
        str_PutByte(str_Ptr(uniCodeDest), 0); // null the destination string
        repeat
            ch := file_GetW(hndl) ;
            putch(ch) ;
            str_Cat(str_Ptr(uniCodeDest), str_Ptr(ch));
            //enummer++;
            //if(msgid>64 && msgid <109 && enummer>2) break;
        until (ch == 0) ;
        print("\nStart\n");
        putstr(uniCodeDest);
        //print([STR]uniCodeDest);
        print("\nstop\n");
    endfunc
    Thank you for reading me.

  • #2
    Unfortunately there is no easy way to do this as the unicode characters are not saved in the 'text' file, principally because the compiler cannot handle anything other than straight ASCII text.

    Anyway I have enhanced the 'ConvertStringtoUnicodeHex' program to generate #DATA and var statements for 4DGL and also written a small 4DGL routine to 'print' them.

    Please see the attached

    Attached Files
    Mark

    Comment

    Working...
    X