ASP.Net-MVC Exporting to PNG Inkscape Unicode Character prob

Discuss SVG code, accessible via the XML Editor.
fatihahlat
Posts: 5
Joined: Thu Jul 24, 2014 6:07 pm

ASP.Net-MVC Exporting to PNG Inkscape Unicode Character prob

Postby fatihahlat » Thu Jul 24, 2014 6:19 pm

Hi all,

i am trying to get Telerik Kendo Charts to png or pdf with Inkspace 0.48 Windows 8.1 version.

Related topic:
http://www.telerik.com/forums/kendo-chart-to-jpg

But i have a problem with Chart's Title. I am using Turkish characters and i can't show Turkish characters on title section. How can i solve this problem?
I have installed Inkscape to my computer. Is there a trick about Inkscape related to Inkscape preferences or something like that?

I upload a picture of situation. I need to see "ç" and "ü" characters.

Thank you.

//here is the code which i use:

Code: Select all


private const string INKSCAPE_PATH = @"C:\Program Files (x86)\Inkscape\inkscape.exe";
        private const int WIDTH = 800;
        private const int HEIGHT = 600;


        private readonly Dictionary<KendoChartExport.Models.ExportFormat, string> MimeTypes = new Dictionary<KendoChartExport.Models.ExportFormat, string>
        {
            { KendoChartExport.Models.ExportFormat.PNG, "image/png" },
            { KendoChartExport.Models.ExportFormat.PDF, "application/pdf" }
        };



        [HttpPost]
        public ActionResult _Export(string svg, KendoChartExport.Models.ExportFormat format)
        {

            var svgText = HttpUtility.UrlDecode(svg);
            var svgFile = TempFileName() + ".svg";
            System.IO.File.WriteAllText(svgFile, svgText);

            var outFile = DoExport(svgFile, format);
            var attachment = "export" + System.IO.Path.GetExtension(outFile);

            return File(outFile, MimeTypes[format], attachment);
        }

        private string DoExport(string svgFile, KendoChartExport.Models.ExportFormat format)
        {

            var extension = format == KendoChartExport.Models.ExportFormat.PNG ? "png" : "pdf";
            var outFile = TempFileName() + "." + extension;
            var inkscape = new System.Diagnostics.Process();
            inkscape.StartInfo.FileName = INKSCAPE_PATH;
            inkscape.StartInfo.Arguments =
                String.Format("--file \"{0}\" --export-{1} \"{2}\" --export-width {3} --export-height {4}",
                              svgFile, extension, outFile, WIDTH, HEIGHT);
            inkscape.StartInfo.UseShellExecute = true;
            inkscape.Start();

            inkscape.WaitForExit();

            return outFile;
        }

        private string TempFileName()
        {
            return System.IO.Path.Combine(Server.MapPath("~/App_Data"), System.IO.Path.GetRandomFileName());
        }


        #endregion


    }
Attachments
1.PNG
1.PNG (1.99 KiB) Viewed 7282 times

User avatar
ragstian
Posts: 1181
Joined: Thu Oct 11, 2012 2:44 am
Location: Stavanger-Norway

Re: ASP.Net-MVC Exporting to PNG Inkscape Unicode Character

Postby ragstian » Thu Jul 24, 2014 7:25 pm

Hi.

Does your exported SVG contain the correct unicode codes for the turkish characters?

See this for unicode;
http://www.physics.nmt.edu/~raymond/software/howtos/greekscape.xhtml
http://unicode.org/charts/PDF/U0370.pdf

Manually typing in the unicode charaters works like a charm in Inkscape.

Code: Select all

Turkish Unicode Characters
ç --> \u00E7
ğ --> \u011F
ı --> \u0131
ş --> \u015F
ö --> \u00F6
ü --> \u00FC
Ç --> \u00C7
Ğ --> \u011E
İ --> \u0130
Ş --> \u015E
Ö --> \u00D6
Ü --> \u00DC


RGDS
Ragnar
Good Luck!
( ͡° ͜ʖ ͡°)
RGDS
Ragnar

fatihahlat
Posts: 5
Joined: Thu Jul 24, 2014 6:07 pm

Re: ASP.Net-MVC Exporting to PNG Inkscape Unicode Character

Postby fatihahlat » Thu Jul 24, 2014 9:27 pm

Hi ragstian, thank you for your reply.

I write to my chart this characters to my chart's title --> (ç,ş,ü,ğ,i,İ,ö,)

and i get the result which in attachment. It seems i have a problem with --> "ç, ü, ö"

Actually i can type Turkish characters on Inkscape's board and there is not any problem. Please check the second attachment.

I dont figure what i can do. How can i solve "ç, ü, ö" characters problem?
Attachments
ink2.PNG
Turkish character problem
ink2.PNG (32.78 KiB) Viewed 7261 times
ink.PNG
any Turkish character problem
ink.PNG (1.02 KiB) Viewed 7261 times

User avatar
ragstian
Posts: 1181
Joined: Thu Oct 11, 2012 2:44 am
Location: Stavanger-Norway

Re: ASP.Net-MVC Exporting to PNG Inkscape Unicode Character

Postby ragstian » Fri Jul 25, 2014 2:38 am

Hi.

Interesting, I tried to export the same characters on my system without problems.

What operating system and which version of Inkscape?

I am using Win7-64 bit, Inkscape 0.48.5 r10040.

RGDS
Ragnar
Good Luck!
( ͡° ͜ʖ ͡°)
RGDS
Ragnar

fatihahlat
Posts: 5
Joined: Thu Jul 24, 2014 6:07 pm

Re: ASP.Net-MVC Exporting to PNG Inkscape Unicode Character

Postby fatihahlat » Fri Jul 25, 2014 4:19 pm

Hi again,

Can you check this out link please?

http://demos.telerik.com/kendo-ui/bar-charts/column

I am trying to export this chart from Asp.net MVC web site. I have character problem with title when i try to export my chart's pic. "Gross domestic product growth ..." i mean. I am not trying to directly export pictures from Inkscape. I havent explained it clearly to you. Forgive my fault.

And there is any problem when i try to export Turkish characters using Inkscape desktop version.

I am using 0.48.5.r10040 Inkscape version.
My operation system is: Windows 8.1 Enterprise version 64 bit.

fatihahlat
Posts: 5
Joined: Thu Jul 24, 2014 6:07 pm

Re: ASP.Net-MVC Exporting to PNG Inkscape Unicode Character

Postby fatihahlat » Fri Aug 08, 2014 9:37 pm

Still same problem :( Any help?

fatihahlat
Posts: 5
Joined: Thu Jul 24, 2014 6:07 pm

Re: ASP.Net-MVC Exporting to PNG Inkscape Unicode Character

Postby fatihahlat » Tue Aug 12, 2014 5:53 pm

Solved!

Thank you for replies @ragstian

Solution:

[HttpPost]
public ActionResult _Export(string svg, KendoChartExport.Models.ExportFormat format)
{
var abc = Encoding.GetEncoding("UTF-8");
svg = svg.Replace("%F6", "ö");
svg = svg.Replace("%D6", "Ö");

svg = svg.Replace("%C7", "Ç");
svg = svg.Replace("%E7", "ç");

svg = svg.Replace("%DC", "Ü");
svg = svg.Replace("%FC", "ü");

svg = svg.Replace("F0", "ğ");
svg = svg.Replace("D0", "Ğ");

svg = svg.Replace("DD", "İ");
svg = svg.Replace("%FD", "ı");

var svgText = HttpUtility.UrlDecode(svg, abc);
var svgFile = TempFileName() + ".svg";
System.IO.File.WriteAllText(svgFile, svgText);

var outFile = DoExport(svgFile, format);
var attachment = "export" + System.IO.Path.GetExtension(outFile);

return File(outFile, MimeTypes[format], attachment);
}


Return to “SVG / XML Code”