alexander.fisher

Special Characters Aren't Working

Recommended Posts

Based on this documentation - http://docs.fusioncharts.com/charts/contents/advanced/special-chars/SpPunctuation.html - I should be able to put special characters in my chart if they are html encoded. I've tried doing this in our product using Δ but rather than seeing the special character I see the text. I had wondered if Δ was just unsupported so I made a plunker to test out the special characters specifically mentioned in the docs but they dont work either.

 

See plunker:

http://embed.plnkr.co/3hSVO0apUL2zJAJTQZJO/preview

Edited by alexander.fisher

Share this post


Link to post
Share on other sites
Guest Sashibhusan

Hi,

 

Could you please try once by providing "Δ" character directly in the chart XML?

 

Ref. Code:

<chart showValues='0'>
   <set label='JanΔ' value='420000' />
   <set label='Feb' value='910000' />
   <set label='Mar' value='720000' />
   <set label='Apr' value='550000' />
</chart>

Please find the screen shot of the cimple Column2D chart using the above XML, for your reference.

 

Hope this helps!

 

post-23588-0-40625000-1403861774_thumb.png

Share this post


Link to post
Share on other sites

Hey,

 

Try using HTML Entity encoding[hex/decimal] for delta characters. Δ or Δ for a  delta character.

<set label='Jan Δ' value='420000' />

Share this post


Link to post
Share on other sites

This is an old thread, so I hope somebody sees this (I can repost it in a new thread as well). I'm using the 2D Donut chart, and in my C# codebehind I'm using a stringbuilder to build my XML string. I added a helper method to parse out all of the special characters referenced in this document: http://docs.fusioncharts.com/charts/contents/advanced/special-chars/SpPunctuation.html. This has fixed a problem I was having getting the charts to render when the data included those characters. However, the chart itself is not re-coding the characters as what they should be, at least in the case of Apostrophes (see attached screenshot). On the left side of this chart, you can see Kohl's and Toys 'R' Us with "%26apos;" (I tried "'" and "%26apos;"), but on the right, Virgin Islands Water & Power Authority is showing the Ampersand correctly (any text truncation is due to the size of the containing div).

 

    private string ReplaceBadChartStrings(string str)
    {
        string strFixed;


        strFixed = str.Replace("'", "%26apos;").Replace("&", "&").Replace(">", ">").Replace("<", "<").Replace("\"", """);


        return strFixed;
    }

Q6001eB.png

Edited by rockiesmagicnumber

Share this post


Link to post
Share on other sites

 

This is an old thread, so I hope somebody sees this (I can repost it in a new thread as well). I'm using the 2D Donut chart, and in my C# codebehind I'm using a stringbuilder to build my XML string. I added a helper method to parse out all of the special characters referenced in this document: http://docs.fusioncharts.com/charts/contents/advanced/special-chars/SpPunctuation.html. This has fixed a problem I was having getting the charts to render when the data included those characters. However, the chart itself is not re-coding the characters as what they should be, at least in the case of Apostrophes (see attached screenshot). On the left side of this chart, you can see Kohl's and Toys 'R' Us with "%26apos;" (I tried "'" and "%26apos;"), but on the right, Virgin Islands Water & Power Authority is showing the Ampersand correctly (any text truncation is due to the size of the containing div).

 

    private string ReplaceBadChartStrings(string str)
    {
        string strFixed;


        strFixed = str.Replace("'", "%26apos;").Replace("&", "&").Replace(">", ">").Replace("<", "<").Replace("\"", """);


        return strFixed;
    }

Q6001eB.png

 

Hi,

 

Could you please use the punctuation marks as is and see if this helps?

Ref.- http://jsfiddle.net/sanjuktamukherjee/sfg61nnv/

 

We did not need to encode the punctuation marks in the above sample, however, the chart is working perfectly.

 

Hope this helps. :)

Share this post


Link to post
Share on other sites

If I don't make an explicit replacement of the apostrophes, the XML breaks and it returns as "Invalid Data" and does not display the chart. It seems like the StringBuilder that concatenates the various XML strings doesn't like the apostrophes, as it breaks the string when it hits that point.

 

I'm using a LINQ query to get the data from SQL, which then runs through a foreach loop:

 

    
protected void createRows(StringBuilder XML, getPreferredPPAsByDeveloperCompanyIDResult y)
    {
        if (y.CompanyName == "Undisclosed")
        {
            XML.Append("<set label='" + ReplaceBadChartStrings(y.CompanyName) + "' value='" + y.TotalCapacityPurchased + "' color='#b30000' />");
        }
        else
        {
            XML.Append("<set label='" + ReplaceBadChartStrings(y.CompanyName) + "' value='" + y.TotalCapacityPurchased + "' />");
        }
    }
    private string ReplaceBadChartStrings(string str)
    {
        string strFixed;


        strFixed = str.Replace("'", "'").Replace("&", "&").Replace(">", ">").Replace("<", "<").Replace("\"", """);


        return strFixed;
    }

When it hits the entries with the apostrophes in the "y.CompanyName" bit (without replacing the characters), it unexpectedly terminates and doesn't close the XML (XML.Append("</chart>)) and the chart fails to render.

Share this post


Link to post
Share on other sites

The character set you have used to save the HTML in does not match the character set the browser thinks is being used.set it to UTF-8. This is a well supported encoding that supports just about any character you are likely to use, along with a large number that you aren't.
 

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