toddz70

Ampersands And Apostrophes Problem

Recommended Posts

Some of my labels and categories have Ampersands and Apostrophes, which FusionCharts is displaying incorrectly.

 

Ampersands become %26

Apostrophes become %26apos;

 

I have tried changing my Ampersands to & and %26 and even %2526. But it never displays a simple normal &.

 

I make this conversion in my php with a simple function alter_display_data() which just does a str_replace("&","&",$myData); and it's given to fusioncharts in $FC->addDataset .

 

$FC->addDataset(

alter_display_data($dataset[$i]['region'])

); // ( legend, options )

 

I read the "Using Special Punctuation on Chart" page in the online docs, but it did not help.

I am running FC 3.2, integrated into a WordPress site.

 

 

thanks in advance!

-todd

Edited by toddz70

Share this post


Link to post
Share on other sites
Guest Angshu

Hi,

 

Welcome to FusionCharts Forum!smile.gif

 

Please note that you would not need to encode special characters in FC 3.2, those will be handled internally.

 

Please try the same by directly embedding special characters in your chart data.

 

Hope this helps.smile.gif

Share this post


Link to post
Share on other sites

Hmm.

If I send FC an ampersand, it is converted to %26. But I am using FC 3.2.1. See all the tests i've done.

 

 

$FC->addDataset( "red and blue" );

legend / tooltips show "red and blue". Good.

 

$FC->addDataset( "red & blue" );

legend / tooltips show "red %26 blue". BAD.

 

$FC->addDataset( "red & blue" );

legend / tooltips show "red %26amp; blue". BAD.

 

$FC->addDataset( "red %26 blue" );

legend / tooltips show "red %26 blue". BAD.

 

$FC->addDataset( "red %2526 blue" );

legend / tooltips show "red %2526 blue". BAD.

 

$FC->addDataset( "red + blue" );

legend / tooltips show "red %2b blue". BAD.

 

$FC->addDataset( "red \& blue" );

legend / tooltips show "red %26 blue". BAD.

 

 

Could there be some other function happening that interferes? Like php's htmlentities, html_entity_decode, urlencode, urldecode, addslashes, stripslashes, or something with magicquotes?

i don't think so though, since my input to FC is right there in the $FC->addDataset();

 

Any ideas?

Thanks!

Todd

Share this post


Link to post
Share on other sites
Guest Angshu

Hi,

 

Thanks for your response.

 

Please follow the steps below:

 

1. Open the FusionCharts_gen.php class file in any text editor.

 

2. Search the line:

 $this->encodeChars=true;

 

3. Replace the line as:

 $this->encodeChars=false;

 

Hope this works.smile.gif

Share this post


Link to post
Share on other sites

YES !!!

Thank you SO much Angshu, that fixed the problem for me!

 

One final question though -- This fix required changing core FusionCharts code. So any future updates to my current of FC will require that I implement this change again. Simple enough, since it is just one line of code. But I wonder.. if this change was required for my site, is it a bug that effects other/all users? If not, why might my site have this problem but others don't? If it is a universal bug, perhaps it will be changed in a future release?

 

Thanks again Angshu. You really saved me on this one.

Share this post


Link to post
Share on other sites
Guest Angshu

Hi,

 

Glad to know that you have managed to resolve your problem.

 

Please note that this issue would be fixed in our future upgrades, so you would not need to change the code again and again.

 

Happy FusionCharting!biggrin.gif

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now