Subject Re: is dBase Plus an Unicode application?
From Mervyn Bick <invalid@invalid.invalid>
Date Sun, 21 Feb 2021 17:57:51 +0200
Newsgroups dbase.getting-started
Attachment(s) unicode_test.wfm

On 2021/02/19 22:11, Ken Mayer wrote:

> In what way? The front-end (IDE) doesn't really understand Unicode
> characters, and so cannot display them properly, but as I know you are
> aware, you can store them in tables ...

A version of dBASE for a language which uses Unicode blocks may well
handle this correctly on forms and in the sourcecode editor.

Certainly, the English version of dBASE can handle double-byte Unicode
blocks on forms but I don't know if it will handle blocks bigger than
that.  One can set the individual bytes in a string object using the
setByte() method.

Although dBASE allocates 2 bytes per character in memory when it comes
to writing values to .dbf files only 1 byte per character is stored.

A backend SQL server can handle Unicode blocks.  I haven't tried this
but components datalinked to a table on a SQL server should display
correctly.

Mervyn.



if file('unicode_test.dbf')
drop table unicode_test
endif

if not file('unicode_test.dbf')
   create table unicode_test  (id autoinc,data character(15))
endif

** END HEADER -- do not remove this line
//
// Generated on 2021-02-21
//
parameter bModal
local f
f = new unicode_testForm()
if (bModal)
   f.mdi = false // ensure not MDI
   f.readModal()
else
   f.open()
endif

class unicode_testForm of FORM
   with (this)
      onOpen = class::FORM_ONOPEN
      height = 16.0
      left = 29.0
      top = 1.1364
      width = 52.4286
      text = ""
   endwith

   this.UNICODE_TEST1 = new QUERY(this)
   with (this.UNICODE_TEST1)
      left = 24.0
      top = 2.0
      width = 10.0
      height = 1.0
      sql = 'select * from "D:\Examples\Plus2019\unicode_test.DBF"'
      active = true
   endwith

   this.TEXT1 = new TEXT(this)
   with (this.TEXT1)
      height = 1.0
      left = 8.7143
      top = 2.0
      width = 12.0
      text = "Text1"
   endwith

   this.TEXTLABEL1 = new TEXTLABEL(this)
   with (this.TEXTLABEL1)
      height = 1.0
      left = 8.7143
      top = 3.8636
      width = 12.0
      text = "Textlabel1"
   endwith

   this.PUSHBUTTON1 = new PUSHBUTTON(this)
   with (this.PUSHBUTTON1)
      height = 1.0909
      left = 8.7143
      top = 5.7273
      width = 15.2857
      text = "Pushbutton1"
   endwith

   this.ENTRYFIELD1 = new ENTRYFIELD(this)
   with (this.ENTRYFIELD1)
      height = 1.0
      left = 8.7143
      top = 7.6818
      width = 11.8571
      value = "Entryfield1"
   endwith

   this.GRID1 = new GRID(this)
   with (this.GRID1)
      dataLink = form.unicode_test1.rowset
      height = 4.0
      left = 3.1429
      top = 9.8182
      width = 43.0
   endwith

   this.rowset = this.unicode_test1.rowset

   function form_onOpen()
         a = new string(space(4))
      for n = 1 to 7 step 2
         a.setbyte(n,0x30)
      next
      x = 0xB0
      for n = 0 to 7 step 2
         a.setbyte(n,x)
         x++
      next
   form.text1.text = a
   form.textlabel1.text = a
   form.pushbutton1.text = a
   form.entryfield1.value = a
   form.unicode_test1.rowset.beginappend()
   form.unicode_test1.rowset.fields['data'].value = a
   form.unicode_test1.rowset.save()
   return

endclass