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

Post Reply
User avatar
dutch
Posts: 1395
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

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

Post 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
Last edited by dutch on Tue Jan 22, 2019 1:59 pm, edited 1 time in total.
Regards,
Dutch

FWH 19.01 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio
FWPPC 10.02 / Harbour for PPC (FTDN)
ADS V.9 / MySql / MariaDB
R&R 12 Infinity / Crystal Report XI R2
(Thailand)
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

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

Post 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.
Regards

G. N. Rao.
Hyderabad, India
User avatar
dutch
Posts: 1395
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

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

Post 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
Regards,
Dutch

FWH 19.01 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio
FWPPC 10.02 / Harbour for PPC (FTDN)
ADS V.9 / MySql / MariaDB
R&R 12 Infinity / Crystal Report XI R2
(Thailand)
User avatar
richard-service
Posts: 583
Joined: Tue Oct 16, 2007 8:57 am
Location: New Taipei City, Taiwan
Contact:

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

Post 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.
Regards,

Richard

Harbour 3.2.0dev (r1904111533)/xHarbour 1.2.3 Intl. (SimpLex) (Build 20180818) => Borland C++ v7.4
xHarbour 0.99.71 (SimpLex) => Borland C++ v5.5
MySQL v5.7 /ADS v12
Harbour 3.2.0dev (r1603181642) => Borland C++ v7.4 64bit
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

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

Post 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
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

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

Post 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.
Regards

G. N. Rao.
Hyderabad, India
User avatar
dutch
Posts: 1395
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

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

Post 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
Regards,
Dutch

FWH 19.01 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio
FWPPC 10.02 / Harbour for PPC (FTDN)
ADS V.9 / MySql / MariaDB
R&R 12 Infinity / Crystal Report XI R2
(Thailand)
User avatar
dutch
Posts: 1395
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

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

Post 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
Regards,
Dutch

FWH 19.01 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio
FWPPC 10.02 / Harbour for PPC (FTDN)
ADS V.9 / MySql / MariaDB
R&R 12 Infinity / Crystal Report XI R2
(Thailand)
User avatar
dutch
Posts: 1395
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

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

Post 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
Regards,
Dutch

FWH 19.01 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio
FWPPC 10.02 / Harbour for PPC (FTDN)
ADS V.9 / MySql / MariaDB
R&R 12 Infinity / Crystal Report XI R2
(Thailand)
Post Reply