utf8 codification problem C#, writing a tex file, and compiling with pdflatex

Posted by voodoomsr on Stack Overflow See other posts from Stack Overflow or by voodoomsr
Published on 2010-06-14T22:55:03Z Indexed on 2010/06/14 23:02 UTC
Read the original article Hit count: 578

Filed under:
|
|

Hi, i have the next code written in C#....it create a tex file using utf-8.....the problem is that appears that is not a real valid utf-8 file because, when i use pdflatex it doesn't recognize the characters with accents. Somebody knows a way to write a real UTF-8 file? When i use TexmakerX to create a utf8 file with the same latex code, pdflatex doesn't complaints, so the problem must be in the generation.

        FileInfo file = new FileInfo("hello.tex");

        StreamWriter writer = new StreamWriter("hello.tex", false, Encoding.UTF8);

        writer.Write(@"\documentclass{article}" + "\n" +
                     @"\usepackage[utf8]{inputenc}" + "\n" +
                    @"\usepackage[spanish]{babel}" + "\n" +
                        @"\usepackage{listings}" + "\n" +
                        @"\usepackage{fancyvrb}" + "\n" +
                        @"\begin{document}" + "\n" +
                        @"\title{asd}" + "\n" +
                        @"\maketitle" + "\n" +
                        @"\section{canción}" + "\n" +

                        @"canción" + "\n" +

                        @"\end{document}");
        writer.Close();

© Stack Overflow or respective owner

Related posts about c#

Related posts about utf-8