CHINESE IN GET

Re: CHINESE IN GET

Postby ukservice » Thu Sep 29, 2011 7:06 pm

Antonio,

in testget.prg I need to paste

Code: Select all  Expand view
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
User avatar
ukservice
 
Posts: 417
Joined: Tue Feb 23, 2010 3:09 pm
Location: John

Re: CHINESE IN GET

Postby richard-service » Thu Sep 29, 2011 7:34 pm

ukservice wrote:Antonio,

in testget.prg I need to paste

Code: Select all  Expand view
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 (r2402101027) => Borland C++ v7.7 32bit
MySQL v5.7 /ADS v10
Harbour 3.2.0dev (r2011030937) => Borland C++ v7.4 64bit
User avatar
richard-service
 
Posts: 780
Joined: Tue Oct 16, 2007 8:57 am
Location: New Taipei City, Taiwan

Re: CHINESE IN GET

Postby Antonio Linares » Thu Sep 29, 2011 8:28 pm

ukservice wrote:Antonio,

in testget.prg I need to paste

Code: Select all  Expand view
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
User avatar
Antonio Linares
Site Admin
 
Posts: 41466
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: CHINESE IN GET

Postby ukservice » Thu Sep 29, 2011 9: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
User avatar
ukservice
 
Posts: 417
Joined: Tue Feb 23, 2010 3:09 pm
Location: John

Re: CHINESE IN GET

Postby Antonio Linares » 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:

Image

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
User avatar
Antonio Linares
Site Admin
 
Posts: 41466
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: CHINESE IN GET

Postby richard-service » Fri Sep 30, 2011 2: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:

Image

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 view

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 (r2402101027) => Borland C++ v7.7 32bit
MySQL v5.7 /ADS v10
Harbour 3.2.0dev (r2011030937) => Borland C++ v7.4 64bit
User avatar
richard-service
 
Posts: 780
Joined: Tue Oct 16, 2007 8:57 am
Location: New Taipei City, Taiwan

Re: CHINESE IN GET

Postby Antonio Linares » Fri Sep 30, 2011 7:02 am

Richard, John,

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

Code: Select all  Expand view
#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:
Image
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41466
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: CHINESE IN GET

Postby ukservice » Fri Sep 30, 2011 8: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
User avatar
ukservice
 
Posts: 417
Joined: Tue Feb 23, 2010 3:09 pm
Location: John

Re: CHINESE IN GET

Postby richard-service » Fri Sep 30, 2011 11:37 am

Antonio,

I got it below:
Image

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 (r2402101027) => Borland C++ v7.7 32bit
MySQL v5.7 /ADS v10
Harbour 3.2.0dev (r2011030937) => Borland C++ v7.4 64bit
User avatar
richard-service
 
Posts: 780
Joined: Tue Oct 16, 2007 8:57 am
Location: New Taipei City, Taiwan

Re: CHINESE IN GET

Postby Antonio Linares » 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
User avatar
Antonio Linares
Site Admin
 
Posts: 41466
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: CHINESE IN GET

Postby Antonio Linares » Fri Sep 30, 2011 6: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: Select all  Expand view
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
User avatar
Antonio Linares
Site Admin
 
Posts: 41466
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: CHINESE IN GET

Postby Antonio Linares » Mon Oct 03, 2011 6:31 am

This example is working fine (got it from Harbour dev list):

Code: Select all  Expand view
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
User avatar
Antonio Linares
Site Admin
 
Posts: 41466
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: CHINESE IN GET

Postby richard-service » Mon Oct 03, 2011 7: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 (r2402101027) => Borland C++ v7.7 32bit
MySQL v5.7 /ADS v10
Harbour 3.2.0dev (r2011030937) => Borland C++ v7.4 64bit
User avatar
richard-service
 
Posts: 780
Joined: Tue Oct 16, 2007 8:57 am
Location: New Taipei City, Taiwan

Re: CHINESE IN GET

Postby Antonio Linares » Mon Oct 03, 2011 7:44 am

Richard,

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

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41466
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: CHINESE IN GET

Postby richard-service » Mon Oct 03, 2011 7: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 (r2402101027) => Borland C++ v7.7 32bit
MySQL v5.7 /ADS v10
Harbour 3.2.0dev (r2011030937) => Borland C++ v7.4 64bit
User avatar
richard-service
 
Posts: 780
Joined: Tue Oct 16, 2007 8:57 am
Location: New Taipei City, Taiwan

PreviousNext

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 139 guests