I have solve my problem, but i dont know really how.
I dont use automatic for Encoding and Type of the feed and it work, without any explication.
Thanks for the help
If you don't have iconv nor mbstring extension, there are no clue.
How can I convert ISO-8859-n (n>1) to UTF-8?
I have do the same yesterday without success.
I try one time more, and i copy your code in the appropriate place and there is a same result.
Xoops dysplay an empty page with only this source :
<html><body></body></html> in FireFox and an error page with IE
When i delete the headlinerenderer.php file the site works but without the RSS i want.
Before to ask you if you have an other idea.
I do some test but i dont know really PHP. I have activate the debug PHP mode and I have an error :
Fatal error: Call to undefined function: iconv() in /var/www/free.fr/5/2/my.login/modules/xhld0/language/french/headlinerenderer.php on line 46.
Is there a solution ?
I've just added ISO-8859-15 to french language files.
language/french/headlinerenderer.php
<?php
if( ! class_exists( 'XhldRendererLocal' ) ) {
class XhldRendererLocal extends XhldRenderer
{
function XhldRendererLocal( &$headline , $mydirname='xhld0' )
{
parent::XhldRenderer( $headline , $mydirname ) ;
}
function convertFromUtf8(&$value, $key)
{
if( ! is_string( $value ) ) return ;
if( stristr( _CHARSET , 'iso-8859-1' ) ) {
$value = utf8_decode( $value ) ;
} else if( $this->_hl->getVar('headline_encoding') == 'iso-8859-1' && ! $this->_hl->getVar('headline_allowhtml') ) {
$value = htmlentities( utf8_decode( $value ) ) ;
} else {
$value = iconv( "UTF-8" , "ISO-8859-15" , $value ) ;
}
}
function &convertToUtf8(&$xmlfile)
{
$encoding = $this->_hl->getVar('headline_encoding') ;
// auto detection
if( empty( $encoding ) ) {
$top_of_xml = substr( $xmlfile , 0 , 255 ) ;
preg_match( "/^<\?xml .* encoding=['\"]?([0-9a-z_-]+)/i", $top_of_xml , $regs ) ;
if( empty( $regs ) ) {
$encoding = 'utf-8' ;
} else {
$encoding = strtolower( $regs[1] ) ;
}
$this->_hl->setVar( 'headline_encoding' , $encoding ) ;
$headline_handler =& xoops_getmodulehandler('headline', $this->_mydirname);
$headline_handler->insert($this->_hl);
}
switch( strtolower( $encoding ) ) {
case 'iso-8859-1' :
$xmlfile = utf8_encode( $xmlfile ) ;
break ;
case 'iso-8859-15' :
$xmlfile = iconv( "ISO-8859-15" , "UTF-8" , $xmlfile ) ;
break ;
case 'utf-8' :
default :
break ;
}
return $xmlfile;
}
}
}
?>
language/french/admin.php
define('_AM_ENCODINGS','utf-8:UTF-8|iso-8859-1:ISO-8859-1|iso-8859-15:ISO-8859-15|us-ascii:US-ASCII') ;
And you should specify the encoding "ISO-8859-15" manually in admin of xhld.
I am trying xoops on a test site before production
I have a problem with a RSS
http://www.atih.sante.fr/feed.rss.php when i try to configure I have the message in french :
"Echec de la sauvegarde des donnñÆs pour la base de donnñÆ du flux headline ATIH XmlParse error: not well-formed (invalid token) at line 3
"
The RSS is Encoded in ISO-8859-15 the normal Charset for France. As you post, i have try to modify
headlinerenderer.php and replacing all WINDOWS-1251 by ISO-8859-15
and in admin.php _AM_ENCODINGS but it locks the site.
So the two question, is it only a charset problem, and if it is how to modify for the different charset.
Thanks