special characters in get box

special characters in get box

Postby plantenkennis » Tue Sep 06, 2016 6:55 pm

Hello,

When I want to show a special character in a get, this does not show the right character. See example
Code: Select all  Expand view  RUN
#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
plantenkennis
 
Posts: 166
Joined: Wed Nov 25, 2015 7:13 pm
Location: the Netherlands

Re: special characters in get box

Postby Antonio Linares » Wed Sep 07, 2016 7:37 am

Rene,

The GETs look fine here:

Image
regards, saludos

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

Re: special characters in get box

Postby Antonio Linares » Wed Sep 07, 2016 7:50 am

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

Re: special characters in get box

Postby Antonio Linares » Wed Sep 07, 2016 7:53 am

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

Re: special characters in get box

Postby plantenkennis » Sun Sep 11, 2016 3:54 pm

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
User avatar
plantenkennis
 
Posts: 166
Joined: Wed Nov 25, 2015 7:13 pm
Location: the Netherlands


Return to FiveMac / FivePhone (iPhone, iPad)

Who is online

Users browsing this forum: No registered users and 17 guests