The Joomla! Forum ™






Post new topic Reply to topic  [ 8 posts ] 
Author Message
PostPosted: Tue Feb 28, 2006 11:29 pm 
Joomla! Fledgling
Joomla! Fledgling
Offline

Joined: Tue Feb 28, 2006 11:16 pm
Posts: 3
After migration from mambo to joomla, I have a problem with com_content's title.  I used to able to type NCR (i.e &#xxxxx) on the title and it store as NCR in database.  So it can display title with Unicode (Chinese).  Now the NCR will convert to some funny character while it store to database. 

NOTE: the existing NCR in the database from Mambo, still display ok (thought need to hack a few place with htmspecialchars(). .  Besides, the introtext and fulltext work ok with NCR. 

I did tried to comment out the ampReplace(row->title) in the content.admin.php but it doesn't work.  Any suggestion are welcome.

-Calvin


Last edited by sogood007 on Wed Mar 01, 2006 12:24 am, edited 1 time in total.

Top
 Profile  
 
PostPosted: Wed Mar 01, 2006 6:47 am 
User avatar
Joomla! Master
Joomla! Master
Offline

Joined: Fri Aug 12, 2005 3:47 pm
Posts: 14953
Location: **Translation Matters**
Welcome on the Joomla! forums.

Could you please precise the version of Joomla as well as the encoding information for the language file (thus site) + encoding characteristics of the database (collation and MyISAM).

Server, PHP version, MySQL version ?

_________________
Jean-Marie Simonet / infograf · http://www.info-graf.fr · GMT +1
Multilanguage in 1.7: http://help.joomla.org/files/EN-GB_mult ... torial.pdf
---------------------------------
Joomla Translation Coordination Team • Joomla! Production Working Group


Top
 Profile  
 
PostPosted: Wed Mar 01, 2006 5:39 pm 
Joomla! Fledgling
Joomla! Fledgling
Offline

Joined: Tue Feb 28, 2006 11:16 pm
Posts: 3
It happened in 2 completely different installation.  (one from a virtual host and one from my own gentoo box).  Both using Joomla 1.0.8.  Language is English.php  (without any change). 

My Gentoo one is running
Linux  2.6.15-gentoo-r1
Database Version: 4.1.14-log
PHP Version: 5.1.1-gentoo

I debug a little bit and find a small test case.  Can anyone try that for me too?
In the news, put 月 in the title.  Try to preview it before you save, the title appear as a chinese character (see attachment) if the browser has Unicode font.  When you save it, the title will appear as 月.  However, if I put the title as 月 ; (with semicolon but not space after &#xxxxx which is the proper NCR , I put a extra space otherwise the forum will convert it to Unicode), the preview still ok but it will become junk after saving it. 

I have tried collation latin1_bin and utf8-general-ci both has similiar behavior if I have semicolon.  Again. The introtext work fine with Unicode &#xxxxx;

Any suggestion are welcome.

-Calvin


You do not have the required permissions to view the files attached to this post.


Last edited by sogood007 on Wed Mar 01, 2006 5:41 pm, edited 1 time in total.

Top
 Profile  
 
PostPosted: Fri Apr 07, 2006 6:28 pm 
Joomla! Explorer
Joomla! Explorer
Offline

Joined: Tue Oct 04, 2005 3:56 pm
Posts: 437
I got a similar problem with Arabic characters in article titles.

I've finally fixed it  myself.
Here's my hack.
On the file includes/phpInputFilter/class.inputfilter.php ,
replace the function "decode": (near line 450)

Code:
   function decode($source)
   {
      // url decode
      $source = html_entity_decode($source, ENT_QUOTES, "ISO-8859-1");
      // convert decimal
      $source = preg_replace('/&#(\d+);/me', "chr(\\1)", $source); // decimal notation
      // convert hex
      $source = preg_replace('/&#x([a-f0-9]+);/mei', "chr(0x\\1)", $source); // hex notation
      return $source;
   }



By this hacked one:

Code:

      function decode($source)
   {
      $source = preg_replace('/&#(\d{2,5});/','#@!\1!@#',$source);
      
      // url decode
      $source = html_entity_decode($source, ENT_QUOTES, "ISO-8859-1");
      // convert decimal
      $source = preg_replace('/&#(\d+);/me', "chr(\\1)", $source); // decimal notation
      // convert hex
      $source = preg_replace('/&#x([a-f0-9]+);/mei', "chr(0x\\1)", $source); // hex notation
      
      $source = preg_replace('/#@!(\d{2,5})!@#/','&#\1;',$source);
      
      return $source;
   }



The idea, is to let the decode  function do its works, without affecting all theses special NCR characters.


Top
 Profile  
 
PostPosted: Fri Apr 07, 2006 9:26 pm 
Joomla! Fledgling
Joomla! Fledgling
Offline

Joined: Tue Feb 28, 2006 11:16 pm
Posts: 3
Thanks.  Great work.  It works.


Top
 Profile  
 
PostPosted: Tue Jan 30, 2007 4:38 pm 
Joomla! Fledgling
Joomla! Fledgling
Offline

Joined: Mon Jan 29, 2007 3:16 pm
Posts: 1
Those modification worked great at the frontend of the website but in the 'contents item manager' of administrator's panel it still shows क (for example) instead of showing Unicode character at the title. Looking at the source code I found क .

Can anybody help me how to display proper Unicode character which the character represents.


Top
 Profile  
 
PostPosted: Tue Jan 30, 2007 6:49 pm 
Joomla! Explorer
Joomla! Explorer
Offline

Joined: Tue Oct 04, 2005 3:56 pm
Posts: 437
Hi,
I recommend to convert the joomla install to support utf8.
It's much better than using NCR, and hacking joomla to support it.
Guide to convert in utf8:
http://forum.joomla.org/index.php/topic,55065.0.htm

good luck


Top
 Profile  
 
PostPosted: Mon Feb 04, 2008 12:12 pm 
Joomla! Fledgling
Joomla! Fledgling
Offline

Joined: Thu Dec 14, 2006 12:33 pm
Posts: 1
Dear All,

we are using Joomla 10.0.12 and JoomFish running 4 languages and had issues with Unicode Character display for the module titles only.
In our case (and yes, that's quick and dirty), it helped to modify the sections in the includes/frontend.html.php file, that handle the title display:
line 393: htmlspecialchars( $module->title )
          changed to:
          SC_htmlspecialchars( $module->title )

same in the lines 361 and 305

the modified code I put in a separate file (to ensure it survives any update) which is included into frontend.html.php.

THis file only contains a basic conversion of the title from the database (making sure the core HTML is not messed with):

function SC_htmlspecialchars($mystring) {

//  Basic title encoding

// no html in the title greater than, less than,
$mystring = preg_replace('/(\<)/','<',$mystring);
$mystring = preg_replace('/(\>)/','>',$mystring);

return $mystring;
}

This works fine with us, but be aware that we are a Web Company, we know what to put in the title and what not.
For Users which are not experienced this might open a door for weird artifacts in the Module titles as the code ist passed from the database to the user interface with almost no check...

Good luck. I hope this helps.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 



Who is online

Users browsing this forum: No registered users and 6 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group