FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour CHINESE IN GET
Posts: 417
Joined: Tue Feb 23, 2010 03:09 PM
Re: CHINESE IN GET
Posted: Thu Sep 29, 2011 07:06 PM
Antonio,

in testget.prg I need to paste

Code (fw): Select all Collapse
RED TEA 华语/華語


It shows RED TEA?????

But If I paste it into Notepad, it works fine.
FWH 11.11, Harbour 3.1 and Borland C++ 5.82
Posts: 866
Joined: Tue Oct 16, 2007 08:57 AM
Re: CHINESE IN GET
Posted: Thu Sep 29, 2011 07:34 PM
ukservice wrote:Antonio,

in testget.prg I need to paste

Code (fw): Select all Collapse
RED TEA 华语/華語


It shows RED TEA?????

But If I paste it into Notepad, it works fine.


I make sample EXE.
testget.exe => add themes
testget2.exe-> Non themes

Please input any Chinese characters and try to press right/left to move position.
try to press delete a Chinese character or insert or paste any Chinese characters.

http://www.fivetech.com.tw/fwh/chinese-test.rar
Best Regards,



Richard



Harbour 3.2.0dev (r2503251254) => Borland C++ v7.7 32bit

MySQL v8.0

Harbour 3.2.0dev (r2503251254) => Borland C++ v7.7 64bit
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: CHINESE IN GET
Posted: Thu Sep 29, 2011 08:28 PM
ukservice wrote:Antonio,

in testget.prg I need to paste

Code (fw): Select all Collapse
RED TEA 华语/華語


It shows RED TEA?????

But If I paste it into Notepad, it works fine.


Very good! I didn't thought of such an easy way to test it :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 417
Joined: Tue Feb 23, 2010 03:09 PM
Re: CHINESE IN GET
Posted: Thu Sep 29, 2011 09:49 PM

Hello.

I paste RED TEA 华语/華語 in both examples and I get in both RED TEA ??/??

If I paste in notepad, i get RED TEA 华语/華語.

FWH 11.11, Harbour 3.1 and Borland C++ 5.82
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: CHINESE IN GET
Posted: Thu Sep 29, 2011 10:55 PM
My first try has been to modify FWH Clipboard object to properly retrieve the unicode text, and it is working fine:



But what I have found is that if we convert the unicode text to ansi code, and then back to unicode, the unicode text does not recover its original format:

MsgInfo( AnsiToWide( WideToAnsi( cUnicodeText ) ) ) <> cUnicodeText

I have also tried with Harbour hb_mbtowc() and hb_wctomb() with no success.

Richard, could you please test the AnsiToWide( WideToAnsi( ... ) ) test and see if you get the original unicode string ? thanks
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 866
Joined: Tue Oct 16, 2007 08:57 AM
Re: CHINESE IN GET
Posted: Fri Sep 30, 2011 02:13 AM
Antonio Linares wrote:My first try has been to modify FWH Clipboard object to properly retrieve the unicode text, and it is working fine:



But what I have found is that if we convert the unicode text to ansi code, and then back to unicode, the unicode text does not recover its original format:

MsgInfo( AnsiToWide( WideToAnsi( cUnicodeText ) ) ) <> cUnicodeText

I have also tried with Harbour hb_mbtowc() and hb_wctomb() with no success.

Richard, could you please test the AnsiToWide( WideToAnsi( ... ) ) test and see if you get the original unicode string ? thanks

Code (fw): Select all Collapse
Function TestUnicode()
Local cUnicodeText := "鱻"

MsgInfo( AnsiToWide( WideToAnsi( cUnicodeText ) ) ) 

RETURN NIL

Display "鱻" Work fine, but I input "鱻" appear "?"
Windows 7 Ultimate 32bit Chinese
Best Regards,



Richard



Harbour 3.2.0dev (r2503251254) => Borland C++ v7.7 32bit

MySQL v8.0

Harbour 3.2.0dev (r2503251254) => Borland C++ v7.7 64bit
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: CHINESE IN GET
Posted: Fri Sep 30, 2011 07:02 AM
Richard, John,

Could you please run this test and post here what you get ? thanks

Code (fw): Select all Collapse
#include "FiveWin.ch"

Function TestUnicode()

   Local cUnicodeText := "RED TEA 华语/華語"

   MsgInfoU( cUnicodeText ) 

RETURN NIL

#pragma BEGINDUMP

#include <windows.h>
#include <hbapi.h>

HB_FUNC( MSGINFOU )
{
   MessageBoxW( GetActiveWindow(), ( WCHAR * ) hb_parc( 1 ), L"Information", 0x40 );
}

#pragma ENDDUMP


Here I get:
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 417
Joined: Tue Feb 23, 2010 03:09 PM
Re: CHINESE IN GET
Posted: Fri Sep 30, 2011 08:13 AM
Antonio and Richard,

First of all, thank you for the help.

Antonio, I get:

[IMG=http://img692.imageshack.us/img692/1126/onezr.png][/IMG]

Uploaded with ImageShack.us


But when I copy forum code to Med editor and save, I get:

[IMG=http://img200.imageshack.us/img200/7961/56816653.png][/IMG]

Uploaded with ImageShack.us
FWH 11.11, Harbour 3.1 and Borland C++ 5.82
Posts: 866
Joined: Tue Oct 16, 2007 08:57 AM
Re: CHINESE IN GET
Posted: Fri Sep 30, 2011 11:37 AM
Antonio,

I got it below:


I remember HongKong's Patrick Fan said, If use Unicode, your source code( PRG ) need to save Unicode format not ANSI format.
Best Regards,



Richard



Harbour 3.2.0dev (r2503251254) => Borland C++ v7.7 32bit

MySQL v8.0

Harbour 3.2.0dev (r2503251254) => Borland C++ v7.7 64bit
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: CHINESE IN GET
Posted: Fri Sep 30, 2011 12:21 PM
Richard,

Yes, I am using UTF8 format from UEStudio but no success. We need first to know what it is missing there so we can continue,

I have posted the same example in the Harbour list, lets see if we get some help

https://groups.google.com/group/harbour-devel/browse_thread/thread/8b5c242824ac011c?hl=es
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: CHINESE IN GET
Posted: Fri Sep 30, 2011 06:07 PM
This example works fine using a C language to declare the string and saved the file as "unicode ansii escaped" from UEStudio. I wonder how to get the same result without the need for the C function:

Code (fw): Select all Collapse
function Main() 

   local cUnicodeText := GetStr() 

   MsgInfoU( cUnicodeText ) 

return nil 

#pragma BEGINDUMP 

#include <windows.h> 
#include <hbapi.h> 

HB_FUNC( MSGINFOU ) 
{ 
   MessageBoxW( GetActiveWindow(), ( WCHAR * ) hb_parc( 1 ), L"Information", 0x40 ); 
} 

HB_FUNC( GETSTR ) 
{ 
   hb_retclen( ( char * ) L"RED TEA 华语/華語", 26 ); 
} 

#pragma ENDDUMP
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: CHINESE IN GET
Posted: Mon Oct 03, 2011 06:31 AM
This example is working fine (got it from Harbour dev list):

Code (fw): Select all Collapse
request HB_CODEPAGE_UTF8 
request HB_CODEPAGE_UTF16LE 

function Main() 

   local cUnicodeText := "RED TEA 华语/華語" 

   MsgInfoU( hb_translate( cUnicodeText, 'UTF8', 'UTF16LE' ) ) 

return nil

#pragma BEGINDUMP

#include <windows.h>
#include <hbapi.h>

HB_FUNC( MSGINFOU )
{
   MessageBoxW( GetActiveWindow(), ( WCHAR * ) hb_parc( 1 ), L"Information", 0x40 );
}

#pragma ENDDUMP
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 866
Joined: Tue Oct 16, 2007 08:57 AM
Re: CHINESE IN GET
Posted: Mon Oct 03, 2011 07:09 AM

Antonio,

Yes, two samples work fine.
So you have any idea for Unicode and Themes within Chinese character??

Best Regards,



Richard



Harbour 3.2.0dev (r2503251254) => Borland C++ v7.7 32bit

MySQL v8.0

Harbour 3.2.0dev (r2503251254) => Borland C++ v7.7 64bit
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: CHINESE IN GET
Posted: Mon Oct 03, 2011 07:44 AM

Richard,

We are working on it. We already implemented support for unicode in the clipboard :-)

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 866
Joined: Tue Oct 16, 2007 08:57 AM
Re: CHINESE IN GET
Posted: Mon Oct 03, 2011 07:52 AM
Antonio Linares wrote:Richard,

We are working on it. We already implemented support for unicode in the clipboard :-)

Sounds great.
Best Regards,



Richard



Harbour 3.2.0dev (r2503251254) => Borland C++ v7.7 32bit

MySQL v8.0

Harbour 3.2.0dev (r2503251254) => Borland C++ v7.7 64bit