Page 2 of 3
Re: CHINESE IN GET
Posted: Thu Sep 29, 2011 7:06 pm
by ukservice
Antonio,
in testget.prg I need to paste
It shows RED TEA?????
But If I paste it into Notepad, it works fine.
Re: CHINESE IN GET
Posted: Thu Sep 29, 2011 7:34 pm
by richard-service
ukservice wrote:Antonio,
in testget.prg I need to paste
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
Re: CHINESE IN GET
Posted: Thu Sep 29, 2011 8:28 pm
by Antonio Linares
ukservice wrote:Antonio,
in testget.prg I need to paste
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

Re: CHINESE IN GET
Posted: Thu Sep 29, 2011 9:49 pm
by ukservice
Hello.
I paste RED TEA 华语/華語 in both examples and I get in both RED TEA ??/??
If I paste in notepad, i get RED TEA 华语/華語.
Re: CHINESE IN GET
Posted: Thu Sep 29, 2011 10:55 pm
by Antonio Linares
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
Re: CHINESE IN GET
Posted: Fri Sep 30, 2011 2:13 am
by richard-service
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: Select all | Expand
Function TestUnicode()
Local cUnicodeText := "鱻"
MsgInfo( AnsiToWide( WideToAnsi( cUnicodeText ) ) )
RETURN NIL
Display "鱻" Work fine, but I input "鱻" appear "?"
Windows 7 Ultimate 32bit Chinese
Re: CHINESE IN GET
Posted: Fri Sep 30, 2011 7:02 am
by Antonio Linares
Richard, John,
Could you please run this test and post here what you get ? thanks
Code: Select all | Expand
#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:

Re: CHINESE IN GET
Posted: Fri Sep 30, 2011 8:13 am
by ukservice
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.usBut 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
Re: CHINESE IN GET
Posted: Fri Sep 30, 2011 11:37 am
by richard-service
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.
Re: CHINESE IN GET
Posted: Fri Sep 30, 2011 12:21 pm
by Antonio Linares
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
Re: CHINESE IN GET
Posted: Fri Sep 30, 2011 6:07 pm
by Antonio Linares
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: Select all | Expand
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
Re: CHINESE IN GET
Posted: Mon Oct 03, 2011 6:31 am
by Antonio Linares
This example is working fine (got it from Harbour dev list):
Code: Select all | Expand
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
Re: CHINESE IN GET
Posted: Mon Oct 03, 2011 7:09 am
by richard-service
Antonio,
Yes, two samples work fine.
So you have any idea for Unicode and Themes within Chinese character??
Re: CHINESE IN GET
Posted: Mon Oct 03, 2011 7:44 am
by Antonio Linares
Richard,
We are working on it. We already implemented support for unicode in the clipboard

Re: CHINESE IN GET
Posted: Mon Oct 03, 2011 7:52 am
by richard-service
Antonio Linares wrote:Richard,
We are working on it. We already implemented support for unicode in the clipboard

Sounds great.