Login Retreive lost passwordRegister
Search

Forum Index / General / SetHelp with unicode characters and overlib

[ This topic is unsolved! ]

  Nikos 19 November 06 / 17:35  
Firstly, as this is the first time I post, congratulation for the great work.
I have an issue trying to use SetHelpText with unicode characters. My text is in Greek and the text returned in the DIV box by overlib is not encoded properly. I tried the htmlenitites function on the help text, setting also the chartset parameter to utf-8 and kind of works, but some special characters are not translated by htmlentities. Since I do not want to go changing the translation table, I am looking for a more straighforward solution.
Has anyone any idea why this occurs in the first place? I searched the overlib site and found nothing appropriate.

  Teye Heimans (Founder) 20 November 06 / 15:41  
The help tekst is first made save by the function "htmlentities" before it is displayed. So, I do not think that's the problem.

Is the html-doctype correct? I'm not a star in solving char-encoding problems...

  Nikos 20 November 06 / 16:51  
 Quote: Teye Heimans
 
The help tekst is first made save by the function "htmlentities" before it is displayed. So, I do not think that's the problem.

Is the html-doctype correct? I'm not a star in solving char-encoding problems...

Yes, the doc type is correct. I suspect that somewhere in the FormHandler code there is an encoding issue, but I cannot trace it. Do you associate the language setting with an encoding anywhere?

  Teye Heimans (Founder) 20 November 06 / 19:15  
Nope, not that I am aware of. I do not even know how to do that (never had to use it before). Could you tell mee where I should be looking for?

  Nikos 20 November 06 / 23:04  
Changed at 20 November 06 / 23:07
Teye,

Nevemind that. I think I found the solution with a little change of the setHelpText function. Here it is:
<?php

//        // escape the values from dangerous characters
//        $helpTitle = is_null($helpTitle) ? "%title% - " . $this -> _text( 41 ) : htmlentities( $helpTitle );
//        $helpTitle = preg_replace("/\r?\n/", "\\n", addslashes( $helpTitle ));
//        $helpText  = preg_replace("/\r?\n/", "\\n", addslashes( $helpText ));
//
        
$helpTitle is_null($helpTitle) ? mb_convert_encoding("%title% - ","HTML-ENTITIES","auto") . $this -> _text41 ) : mb_convert_encoding($helpTitle,"HTML-ENTITIES","auto" );
        
$helpTitle preg_replace("/\r?\n/""\\n"addslashes$helpTitle ));
        
$helpText  preg_replace("/\r?\n/""\\n"addslashes$helpText ));
//        // set the help text
//        $this->_help[$field] = array(
//        htmlentities( $helpText ),
//        $helpTitle
//        );
        
$this->_help[$field] = array(
        
mb_convert_encoding$helpText,"HTML-ENTITIES","auto" ),
        
$helpTitle
        
);
?>


I still have a problem with the title taken from the form as I cannot find how to assign the %title% to a variable so that I convert it to a multibyte string. Can you help there?

  Teye Heimans (Founder) 22 November 06 / 23:29  
That happens on line 3338 in class.FormHandler.php:

<?php

/**
 * Get the help string
 */
$help '';
if( 
array_key_exists$name$this->_help) && !$this -> isViewMode() && !$this->isFieldViewMode($name) )
{
    
$help sprintf(
      
FH_HELP_MASK,
      
$this->_helpIcon,
      
$this->_help[$name][0],
      
str_replace(
        
'%title%',
        
addslasheshtmlentities($title) ),
        
$this->_help[$name][1]
      )
    );
}


?>

  Nikos 27 November 06 / 19:56  
Many thanks Teye. That will do!

  kreatik 28 February 09 / 13:33  
Hi all,

possible to include this fix in next release ?

utf-8 with setHelp is not good actually.

  Johan Wiegel (Admin) 01 March 09 / 11:57  
this fix is in the coding as far as i can see.

What is not working?

can you give an example?

  kreatik 11 June 09 / 18:56  
With the latest version : http://img269.imageshack.us/img269/8171/bugutf8.jpg

UTF8 are not good supported in FH ! :(

  Johan Wiegel (Admin) 16 June 09 / 19:47  
can you please send me your sethelp code as a testing example?

  Johan Wiegel (Admin) 28 June 09 / 13:06  
$oForm->setHelpText('test','éáóçê');

seems to give me the right output.

Please send me your sethelptext code to test your situation.

  Top


powered by PHP-GLOBE   © 2004 - 2010 FormHandler. All rights reserved.   -   Open source license