Sign in to follow this  
daade

Turkish Characters..

Recommended Posts

Hi again

I'm using fusioncharts for generating some charts about Turkey's general elections.

I send the data to an xml.

In an other page,I'm picking the XML and showing the chart.

Everything is OK from now on.

When the chart is shown, Turkish Characters doesn't seem right on..

I think I have to append a language code like utf-8, but didnt find which code snippet I should append, and where to append??

Edited by daade

Share this post


Link to post
Share on other sites

Thank you Angshu

 

I tried your reply, but doesnot work

 

Could you please tell me, where I'm misunderstanding..

 

I'm sending the code snippet and the error message

 

 

strXML = "<chart captionPadding='2' chartTopMargin='2' chartLeftMargin='2' chartBottomMargin='2' chartRightMargin='2' caption='" + ilAdGetir(il) + "' bgcolor='#EEEEEE' decimalPrecision='2' showNames='1' numberPrefix=' %25' decimalSeparator='.' >";

 

for (int i = 0; i < 6; i++)

 

{

 

PartiAd = partiAdGetir(Convert.ToInt32(ilk6Parti[i, 0]));

 

strXML += "<set name='" + PartiAd.ToString() + "' value='" + Convert.ToString(ilk6Parti[i, 1]) + "' />";

 

}

 

strXML += "<set name='DİĞER' value='" + Convert.ToString(diger) + "' />";

 

strXML += "<styles>";

 

strXML += "<definition>";

 

strXML += "<style name='CaptionFont' type='font' face='Verdana' size='18' color='000000' bold='1' />";

 

strXML += "</definition>";

 

strXML += "<application>";

 

strXML += "<apply toObject='Caption' styles='CaptionFont' />";

 

strXML += "</application>";

 

strXML += "</styles>";

 

strXML += "</chart>";

 

strXML = strXML.Replace(",", ".");

 

XmlDocument doc = new XmlDocument();

 

Response.ContentType = "text/xml; characterset=utf-8";

 

Response.BinaryWrite(new byte[] { 0xEF, 0xBB, 0xBF });

 

doc.LoadXml(strXML);

 

path = Server.MapPath(".") + "/Data/" + ilAdGetir(il);

 

doc.Save(path+"Pie.xml");

 

///////AND THE ERROR IS :

 

 

 

This page contains the following errors:

error on line 1 at column 1: Document is empty

Below is a rendering of the page up to the first error.

Share this post


Link to post
Share on other sites
Guest Angshu

Hi,

 

Thanks for your response.

You would need to write your XML data to output stream to response back.

 

Please remove the lines below:

 

doc.LoadXml(strXML);

 

path = Server.MapPath(".") + "/Data/" + ilAdGetir(il);

 

doc.Save(path+"Pie.xml");

Add this line to your code:

 

Response.Write(strXML.ToString());

 

Hope this works.smile.gif

Share this post


Link to post
Share on other sites

but I have to save an XML file for each city votes..

 

saving XML file is must..

 

is there any way to do this in XML file?

Share this post


Link to post
Share on other sites

Hi,

 

If you would need to save it, please save it, but also send the data in response.

 

Like:

 

XmlDocument doc = new XmlDocument();
doc.LoadXml(strXML);
path = Server.MapPath(".") + "/Data/" + ilAdGetir(il);
doc.Save(path+"Pie.xml");

Response.ContentType = "text/xml; characterset=utf-8";
Response.BinaryWrite(new byte[] { 0xEF, 0xBB, 0xBF });
Response.Write(strXML.ToString());

 

However, you would need o figure out how (may be using a file stream writer instead of using XMLDocument) you would can add BOM Stamp to the XML file you are saving. Writing Response.BinaryWrite(new byte[] { 0xEF, 0xBB, 0xBF }); wont set your file. It only sets the Response stream.

Share this post


Link to post
Share on other sites

I think something is wrong with me..

I still could not understand how I can show the chart..

 

The places where I'm saving XML file and rendering chart are different..

 

the place where I'm saving XML :

 

XmlDocument doc = new XmlDocument();

 

doc.LoadXml(strXML);

 

path = Server.MapPath(".") + "/Data/" + ilAdGetir(il);

 

doc.Save(path+"Pie.xml");

 

the place where I'm rendering chart :

<div class="celldiv" id="chartdiv1" style="padding-top: 10px; width: 548px; height: 305px;">

 

<%=CreatePieChart(Convert.ToInt32(Session["ilId"]))%></div>

 

and CreatePieChart() is:

 

protected string CreatePieChart(int il)

 

{

 

string ilinAdi = ilAdGetir(il);

 

string path = "http://localhost:2488/Data/" + ilinAdi + "Pie.xml";

 

return FusionCharts.RenderChart("FusionCharts/Pie3D.swf",path, "", ilinAdi+"Pie", "548", "305", false, false);

 

}

 

And Could you please tell me, where to paste BOM code????

 

 

Share this post


Link to post
Share on other sites

Hi Guys

Nevermind the previous post.

It works after inserting the below code to the top of strXML stream.

 

"<?xml version='1.0' encoding='UTF-8'?>";

 

Thank you for your kind answers :)

 

Share this post


Link to post
Share on other sites
Guest Angshu

Hi,

 

You are always welcome.smile.gif

 

We are glad to know that you have managed to resolve your problem.

 

Keep smiling and keep 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
Sign in to follow this