Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Niels Kristiansen 166 posts 382 karma points
    Feb 29, 2012 @ 16:47
    Niels Kristiansen
    0

    Charset to utf-8

    Hi,

    I'm using this excellent little piece of tools to fix a download for CSV, but it will not save it with the charset, so æ, ø and å is changed to wierd characters.

    What do I miss to get up running with danish characters? It works if just save the source as .csv

    Here is the code used:

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp "&#x00A0;"> ]>
    <xsl:stylesheet
    version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:msxml="urn:schemas-microsoft-com:xslt"
    xmlns:gecko="urn:gecko-com:xslt"
    xmlns:umbraco.library="urn:umbraco.library" xmlns:Exslt.ExsltCommon="urn:Exslt.ExsltCommon" xmlns:Exslt.ExsltDatesAndTimes="urn:Exslt.ExsltDatesAndTimes" xmlns:Exslt.ExsltMath="urn:Exslt.ExsltMath" xmlns:Exslt.ExsltRegularExpressions="urn:Exslt.ExsltRegularExpressions" xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings" xmlns:Exslt.ExsltSets="urn:Exslt.ExsltSets"
    exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets gecko">
    <xsl:output method="text" indent="no" encoding="UTF-8" />


    <msxml:script language="CSharp" implements-prefix="gecko">
    <msxml:assembly name="System.Web" />
    <msxml:using namespace="System.Web" />

    <![CDATA[
    public void changeOutPut(String ContentType, String FileName) {
    HttpContext.Current.Response.ContentType = ContentType;
    HttpContext.Current.Response.AddHeader("content-disposition", "attachment;filename=" + FileName);
    }
    ]]>

    </msxml:script>


    <xsl:param name="currentPage"/>
    <xsl:variable name="fileName">
    <xsl:choose>
    <xsl:when test="string-length(umbraco.library:Request('filename')) &gt; 0">
    <xsl:value-of select="umbraco.library:Request('filename')"/>
    </xsl:when>
    <xsl:otherwise>
    <xsl:text>defaultFilename.extension</xsl:text>
    </xsl:otherwise>
    </xsl:choose>
    </xsl:variable>

    <xsl:template match="/">
    <xsl:value-of select="gecko:changeOutPut('text/csv',$fileName)" />
    </xsl:template>

    </xsl:stylesheet>

     

    Hoppefully someone can help me out :)

    Thanks so much.

     

    Kind regads,

    Niels

  • Jan Skovgaard 11280 posts 23678 karma points MVP 10x admin c-trib
    Feb 29, 2012 @ 17:56
    Jan Skovgaard
    0

    Hi Niels

    what happens if you add the attribute disable-output-escaping="yes" on your value-of?

    Like <xsl:value-of select="gecko:changeOutPut('text/csv', $filename)" disable-output-escaping="yes" />

    /Jan

  • Niels Kristiansen 166 posts 382 karma points
    Feb 29, 2012 @ 19:59
    Niels Kristiansen
    0

    No, it don't work unfortunately. It still show up with wierd chars, but thanks for the reply :)

  • Bjarne Fyrstenborg 1280 posts 3990 karma points MVP 7x c-trib
    Feb 29, 2012 @ 20:46
    Bjarne Fyrstenborg
    0

    Hi Niels

    I have a similar problem with vcards.. when I open the .vcf file in notepad it also displays the danish letters æ, ø and å.. but when I open the file in Windows Live Mail or Outlook it displays Ã¸ instead of ø ..

    If I open the .vcf file in outlook, change Ã¸ with ø and save the file and open that file in notepad, it has replaced ø with =F8

    Bjarne

  • Niels Kristiansen 166 posts 382 karma points
    Feb 29, 2012 @ 22:02
    Niels Kristiansen
    0

    Hehe, yes - I actually looked at your post at the forum before asking and I could see you didn't got an answer.

    Æ, ø and å actually showed up correctly in Numbers (Macs Excel version) so I guess it must have something to do with Excel or vCard itself not reading utf-8 that well - or something.

Please Sign in or register to post replies

Write your reply to:

Draft