Results 1 to 6 of 6

Thread: 4.5 accent in flash chart

  1. #1
    kboughanem is offline Sugar Community Member
    Join Date
    Mar 2006
    Posts
    83

    Default 4.5 accent in flash chart

    Hi,

    We've finished the french translation for SugarCRM 4.5.0 but there's a problem with accent in Flash charts

    How can we do to resolve this problem...

    Thanks
    Attached Images Attached Images  

  2. #2
    Markku's Avatar
    Markku is offline Sugar Community Member
    Join Date
    Nov 2004
    Location
    Helsinki
    Posts
    910

    Default Re: 4.5 accent in flash chart

    We have the same problem, any ideas?

  3. #3
    clint's Avatar
    clint is offline Sugar Team Member | Forums Lead Moderator
    Join Date
    Aug 2004
    Location
    Silicon Valley
    Posts
    2,120

    Default Re: 4.5 accent in flash chart

    A bug fix was submitted to us today by our friends at Synolia. We're going to try it out, but I wanted to see if you folks could also see if it works for you.


    In file "*/include/charts/charts.php/*" on line 86 the test for value $app_strings['LBL_CHARSET'] is:
    if ($app_strings['LBL_CHARSET'] != "UTF-8") ....

    It should be:
    if ($app_strings['LBL_CHARSET'] == "UTF-8")
    Sugar Developer Zone - developer resources | Sugar University - user and admin training
    Sugar Docs - user and admin documentation |
    Sugar Bug Tracker - Enter or view bugs
    SugarForge- open source modules, themes, lang packs | SugarExchange - commercial extensions

    Clint Oram
    Chief Technology Officer and Co-founder
    SugarCRM

  4. #4
    Markku's Avatar
    Markku is offline Sugar Community Member
    Join Date
    Nov 2004
    Location
    Helsinki
    Posts
    910

    Default Re: 4.5 accent in flash chart

    Works great, thanks for the info and kudos to Synolia guys!

    line 86 in Charts.php states now
    Code:
    if ($app_strings['LBL_CHARSET'] == "UTF-8") {

  5. #5
    aserrano is offline Sugar Community Member
    Join Date
    Nov 2004
    Location
    Alicante, Spain
    Posts
    57

    Default Re: 4.5 accent in flash chart

    Hi, I had to revert that change.

    For the Spanish language pack, it should be:

    if ($app_strings['LBL_CHARSET'] != "UTF-8") {

    instead of:

    if ($app_strings['LBL_CHARSET'] == "UTF-8") {


    The problem is that, when you set LBL_CHARSET to UTF-8 in include/language/xx_xx.lang.php, you use that character set for your localized PHP files. And if you do so, using utf8_encode on already UTF-8 encoded strings will mess up the results.

    Given the fact that most strings used in the charts (maybe all strings?) come from localized files (_and_ therefore UTF-8 encoded when LBL_CHARSET is UTF-8), perhaps we should use utf8_encode not with the whole file, but just with the strings that don't come from localized files, if there are any of such strings.

    If there are not such strings, I can't see the point on using utf8_encode when LBL_CHARSET is UTF-8. Only if the localized xx_xx.lang.php files used a differente encoding and LBL_CHARSET is UTF-8 and, in that case, the charts would display properly but not the rest of the HTML page.

    AFAIK, utf8_encoded should be used just when LBL_CHARSET is not UTF-8, because the flash generation code requires, with its current configuration, that its input xml file is UTF-8 encoded, and that's ok.

    IMHO, if the charts just use string literals from the localized language files, you should revert that patch, and encourage people to save their localized PHP files in the same character set they establish in LBL_CHARSET (time to update http://www.sugarcrm.com/wiki/index.p...Language_Packs ?)

    UPDATE: This issue has been reported in bugs #9502 and #9200.
    Last edited by aserrano; 2006-10-19 at 04:11 PM. Reason: References to bug tracker

  6. #6
    dricrm is offline Sugar Community Member
    Join Date
    Aug 2005
    Location
    Lisbon, Portugal
    Posts
    116

    Default Re: 4.5 accent in flash chart

    I would change the whole if/else section with something like this:

    Code:
    if (function_exists('mb_convert_encoding')) {
    		//best way, if available
    		$xml_file = mb_convert_encoding($xml_file, 'UTF-8');
    	}
    	elseif ($app_strings['LBL_CHARSET'] != 'UTF-8') {
    		if (function_exists('iconv')) {
    			$xml_file = iconv($app_strings['LBL_CHARSET'], 'UTF-8', $xml_file);
    		}
    		else {
    			$xml_file = utf8_encode($xml_file);
    		}
    	}
    	if (fwrite($handle, $xml_file) === FALSE) {
    		$GLOBALS['log']->debug("Cannot write to file ($filename)");
    		return false;
    	}
    in this way:
    1. it would try to use first the mb encoder, which doesnt harm already utf8 encoded strings
    2. if mb is not available, but charset is not utf8, then we have to translate it for flash, so we try to use iconv, if available
    3. if we dont have iconv, we try to use utf8 encode, but remember, it only encodes Latin1 correctly, so this is the worst case
    4. then we write out the string, the writing, and the encoding code is now separated

    regards,
    Adam Maschek@DRI

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •