Page 1 of 1

How to turn off FW_SetUnicode(.T.) *Fixed*

Posted: Sat Jan 19, 2019 2:02 pm
by dutch
I try to OFF FW_SetUnicode( .F. ) but it is still effect. How to set for backward compatible? Because I do not set FW_SetUnicode(.T.) but TGet is still got Unicode behavior.

I use Thai with old version of FWH. When I change to FWH 1812, I try Thai language but when it saves as Unicode to DBF file.
- It show in XBROWSE or TGET are correctly but It show incorrect in CDBF (database tool).

Thanks in advance,
Dutch

Re: How to turn off FW_SetUnicode(.T.)

Posted: Mon Jan 21, 2019 3:00 am
by nageswaragunupudi
If you do not set FW_Unicode( .T. ) at the beginning of the application (before the creation of the first window or dialog), the application is an ANSI application.

Even in an ANSI (non Unicode) application, you can display Unicode strings but cannot edit (or input) Unicode characters. You can also read and save Unicode strings without problems.

Please let us know what is your exact problem.

Re: How to turn off FW_SetUnicode(.T.)

Posted: Mon Jan 21, 2019 3:31 am
by dutch
Dear Master Rao,
nageswaragunupudi wrote:If you do not set FW_Unicode( .T. ) at the beginning of the application (before the creation of the first window or dialog), the application is an ANSI application.

Even in an ANSI (non Unicode) application, you can display Unicode strings but cannot edit (or input) Unicode characters. You can also read and save Unicode strings without problems.

Please let us know what is your exact problem.
I do not set FW_Unicode( .T. ) at the beginning of the application but it save to DBF file as unicode charactor as picture.
The program display correct even Unicode in DBF file but in other program cannot report or print (if it does not support unicode).
I have one point. If I use TDATABASE, it save correctly.
Case 1
==========
cDesc := "เบียร์ช้าง" -> save as picture, unreadable
TRN_DESC := cDesc

Case 2
==========
DATABASE oDbf
oDbf:TRN_DESC := "เบียร์ช้าง" -> save correct and readable
Image

Thanks in advance,
Dutch

Re: How to turn off FW_SetUnicode(.T.)

Posted: Mon Jan 21, 2019 9:08 am
by richard-service
nageswaragunupudi wrote:If you do not set FW_Unicode( .T. ) at the beginning of the application (before the creation of the first window or dialog), the application is an ANSI application.

Even in an ANSI (non Unicode) application, you can display Unicode strings but cannot edit (or input) Unicode characters. You can also read and save Unicode strings without problems.

Please let us know what is your exact problem.
Hi Mr.Rao
I have a question about it.
I use FiveDbu( use FW_Unicode(.T.) and Unicode PRG ) open sample\customer.dbf and input Unicode Chinese word.
use FWH compile PRG and Run EXE look Customer.dbf Work fine.
But Use other tools to view it not work.
Image
Look right tools.I open Customer.dbf not work( view Unicode word ),
but I connect to MySQL table and view data work fine( I use My APP[FW_Unicode(.t.)] work fine).
Below:
Image

So I guess, FWH build FW_Unicode(.T.) EXE input DBFs work only for FWH. Other tools open it not work.

Re: How to turn off FW_SetUnicode(.T.)

Posted: Mon Jan 21, 2019 4:37 pm
by nageswaragunupudi
Mr. Dutch

It should work exactly the same way both case-1 and case-2.

Here is a test. This is not a Unicode application and is an ANSI application.

Code: Select all

#include "fivewin.ch"

function Main()

   field CITY
   local cStr  := "เบียร์ช้าง"

   ? LEN( cStr ), HB_UTF8LEN( cStr )

   USE CUSTOMER

   CITY := cStr
   DBCOMMIT()

   ? CITY, LEN( TRIM( CITY ) ), HB_UTF8LEN( TRIM( CITY ) ), ;
     TRIM( CITY ) + "," + TRIM( CITY )

return nil
 
Image

Re: How to turn off FW_SetUnicode(.T.)

Posted: Mon Jan 21, 2019 4:43 pm
by nageswaragunupudi
Mr. Richard
So I guess, FWH build FW_Unicode(.T.) EXE input DBFs work only for FWH. Other tools open it not work.
Not correct at all. The text saved in DBF is compatible with all application which can read and display utf8 character-set strings.

If you are not able to view them in any other tools, those tools are either not (1) capable of or (2) configured to read and display UTF8 formatted Unicode text.

In the case of ancient languages like Chinese, Korean, etc., confusion might arise between UTF8 encoding and other encodings like Big5, utf8ex, etc. which are all different from each other.
FWH reads and stores text encoded in UTF8, which is Universal.

Re: How to turn off FW_SetUnicode(.T.)

Posted: Tue Jan 22, 2019 7:06 am
by dutch
Dear Master Rao,
nageswaragunupudi wrote:Mr. Dutch

It should work exactly the same way both case-1 and case-2.

Here is a test. This is not a Unicode application and is an ANSI application.

Code: Select all

#include "fivewin.ch"

function Main()

   field CITY
   local cStr  := "เบียร์ช้าง"

   ? LEN( cStr ), HB_UTF8LEN( cStr )

   USE CUSTOMER

   CITY := cStr
   DBCOMMIT()

   ? CITY, LEN( TRIM( CITY ) ), HB_UTF8LEN( TRIM( CITY ) ), ;
     TRIM( CITY ) + "," + TRIM( CITY )

return nil
 
Image
I just change to FWH1812 and do not change any code but the problem is FWH write data in Unicode format to DBF file but FWH has not any problem, because FWH can read and show ANSI or Unicode correctly, even in DBF file. I don't set FW_Unicode( .T. ) in the program. But I cannot to save to DBF file with ANSI format for Thai charactor with new version.

I'm not quite sure that, Is the TSButtonx.lib (support unicode) concerned?

I write the function to convert UTF8TOTIS620() to convert from UTF8 -> TIS620 (Thai ANSI) and I can save Thai.

Image

Thanks in advance,
Dutch

Re: How to turn off FW_SetUnicode(.T.)

Posted: Tue Jan 22, 2019 8:23 am
by dutch
Dear Master Rao,

Another point ANSI clause in TGET is not support Thai Character. I cannot use ANSI clause too.

Thanks in advance,
Dutch

Re: How to turn off FW_SetUnicode(.T.) *Fixed*

Posted: Tue Jan 22, 2019 2:03 pm
by dutch
Dear Master Rao,

I'm sorry for my fault, the problem is fw_setunicode(.t.) is in the TWBRW32X.LIB since I start modified to support unicode 2 years ago. I don't aware about it.

Thx for kind help.
Dutch