special characters in get box

Post Reply
User avatar
plantenkennis
Posts: 151
Joined: Wed Nov 25, 2015 7:13 pm
Location: the Netherlands
Contact:

special characters in get box

Post by plantenkennis »

Hello,

When I want to show a special character in a get, this does not show the right character. See example

Code: Select all

#include "FiveMac.ch"

function Main()

   local oDlg 
   local cText1 := "Abelia ×grandiflora", cText2 := "Abelia schumannii 'Bumblebee'", cText3 := "Ceanothus ×delilianus 'Henri Défossé' "
   
   SET DATE FRENCH
   
   DEFINE DIALOG oDlg TITLE "TestGet" SIZE 400, 200 FLIPPED
   
   @ 15, 30 SAY "Text1:" OF oDlg
   
   @ 15, 90 GET cText1 OF oDlg TOOLTIP "a string with cross" SIZE 350, 25

   @ 45, 30 SAY "Text2:" OF oDlg

   @ 45, 90 GET cText2 OF oDlg TOOLTIP "a string with apo" SIZE 350, 25

   @ 75, 30 SAY "Text3:" OF oDlg

   @ 75, 90 GET cText3 OF oDlg TOOLTIP "a normal string" SIZE 350, 25
   
   @ 140, 150 BUTTON "Ok" OF oDlg ACTION MsgInfo( cText1 ), MsgInfo( cText2 ), MsgInfo( cText3 )
   
   ACTIVATE DIALOG oDlg CENTERED
         
return nil

 
But when I get the string from a database, the string is shown good, but I can't get the changed text in a msgbox

Rene
Kind regards,

René Koot
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: special characters in get box

Post by Antonio Linares »

Rene,

The GETs look fine here:

Image
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: special characters in get box

Post by Antonio Linares »

Rene,

Currently we are using the encoding NSUTF8StringEncoding to retrieve the string parameter:

NSString * hb_NSSTRING_par( int iParam )
{
return [ [ [ NSString alloc ] initWithCString: HB_ISCHAR( iParam ) ? hb_parc( iParam ) : "" encoding: NSUTF8StringEncoding ] autorelease ];
}

These are the possible encoding values:
enum {
NSASCIIStringEncoding = 1,
NSNEXTSTEPStringEncoding = 2,
NSJapaneseEUCStringEncoding = 3,
NSUTF8StringEncoding = 4,
NSISOLatin1StringEncoding = 5,
NSSymbolStringEncoding = 6,
NSNonLossyASCIIStringEncoding = 7,
NSShiftJISStringEncoding = 8,
NSISOLatin2StringEncoding = 9,
NSUnicodeStringEncoding = 10,
NSWindowsCP1251StringEncoding = 11,
NSWindowsCP1252StringEncoding = 12,
NSWindowsCP1253StringEncoding = 13,
NSWindowsCP1254StringEncoding = 14,
NSWindowsCP1250StringEncoding = 15,
NSISO2022JPStringEncoding = 21,
NSMacOSRomanStringEncoding = 30,
NSUTF16StringEncoding = NSUnicodeStringEncoding,
NSUTF16BigEndianStringEncoding = 0x90000100,
NSUTF16LittleEndianStringEncoding = 0x94000100,
NSUTF32StringEncoding = 0x8c000100,
NSUTF32BigEndianStringEncoding = 0x98000100,
NSUTF32LittleEndianStringEncoding = 0x9c000100,
NSProprietaryStringEncoding = 65536
};
typedef NSUInteger NSStringEncoding;
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: special characters in get box

Post by Antonio Linares »

This is the MsgInfo() source code:

HB_FUNC( MSGINFO )
{
NSString * msg, * title;

CocoaInit();

ValToChar( hb_param( 1, HB_IT_ANY ) );
msg = hb_NSSTRING_par( -1 );
if( [ msg length ] == 0 )
msg = @" " ;

if( hb_pcount() > 1 )
{
ValToChar( hb_param( 2, HB_IT_ANY ) );
title = hb_NSSTRING_par( -1 );
if( [ title length ] == 0 )
title = @"Attention" ;
}
else
title = @"Attention";

NSAlert * alert = [ [ NSAlert alloc ] init ];

alert.alertStyle = NSInformationalAlertStyle ;
alert.informativeText = msg ;
alert.messageText = title ;

[ alert addButtonWithTitle:@"OK"];
[ alert runModal ];
[ alert release ];

hb_ret();
}

If we change the enconding used in hb_NSSTRING_par(), then the MsgInfo() may look fine
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
plantenkennis
Posts: 151
Joined: Wed Nov 25, 2015 7:13 pm
Location: the Netherlands
Contact:

Re: special characters in get box

Post by plantenkennis »

Hello Antonio,
Thanks for the reply, but I get to see this on my screen:
Image

Can/must I change the encoding somewhere?

Rene
Kind regards,

René Koot
Post Reply