CHINESE IN GET

User avatar
ukservice
Posts: 417
Joined: Tue Feb 23, 2010 3:09 pm
Location: John

Re: CHINESE IN GET

Post by ukservice »

Antonio,

in testget.prg I need to paste

Code: Select all

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
richard-service
Posts: 583
Joined: Tue Oct 16, 2007 8:57 am
Location: New Taipei City, Taiwan
Contact:

Re: CHINESE IN GET

Post by richard-service »

ukservice wrote:Antonio,

in testget.prg I need to paste

Code: Select all

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

Re: CHINESE IN GET

Post by Antonio Linares »

ukservice wrote:Antonio,

in testget.prg I need to paste

Code: Select all

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
ukservice
Posts: 417
Joined: Tue Feb 23, 2010 3:09 pm
Location: John

Re: CHINESE IN GET

Post 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 华语/華語.
FWH 11.11, Harbour 3.1 and Borland C++ 5.82
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: CHINESE IN GET

Post by Antonio Linares »

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
richard-service
Posts: 583
Joined: Tue Oct 16, 2007 8:57 am
Location: New Taipei City, Taiwan
Contact:

Re: CHINESE IN GET

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

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

Function TestUnicode()
Local cUnicodeText := "鱻"

MsgInfo( AnsiToWide( WideToAnsi( cUnicodeText ) ) ) 

RETURN NIL
 
Display "鱻" Work fine, but I input "鱻" appear "?"
Windows 7 Ultimate 32bit Chinese
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
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: CHINESE IN GET

Post by Antonio Linares »

Richard, John,

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

Code: Select all

#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
ukservice
Posts: 417
Joined: Tue Feb 23, 2010 3:09 pm
Location: John

Re: CHINESE IN GET

Post 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.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
richard-service
Posts: 583
Joined: Tue Oct 16, 2007 8:57 am
Location: New Taipei City, Taiwan
Contact:

Re: CHINESE IN GET

Post by richard-service »

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

Re: CHINESE IN GET

Post 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 ... 011c?hl=es
regards, saludos

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

Re: CHINESE IN GET

Post 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

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: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: CHINESE IN GET

Post by Antonio Linares »

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

Code: Select all

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
richard-service
Posts: 583
Joined: Tue Oct 16, 2007 8:57 am
Location: New Taipei City, Taiwan
Contact:

Re: CHINESE IN GET

Post by richard-service »

Antonio,

Yes, two samples work fine.
So you have any idea for Unicode and Themes within Chinese character??
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
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: CHINESE IN GET

Post by Antonio Linares »

Richard,

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

Antonio Linares
www.fivetechsoft.com
User avatar
richard-service
Posts: 583
Joined: Tue Oct 16, 2007 8:57 am
Location: New Taipei City, Taiwan
Contact:

Re: CHINESE IN GET

Post by richard-service »

Antonio Linares wrote:Richard,

We are working on it. We already implemented support for unicode in the clipboard :-)
Sounds great.
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
Post Reply