Colfusion word document and Greek characters

Discussion in 'Programming' started by anarchos78, Jun 1, 2012.

  1. #1
    I am trying to build dynamically word docs(from database-i am using a CFC for query handling). My efforts were successful, but only for English language(i can reproduce docs in English). My app is in Greek language. When i try to build doc containing Greek characters the output is look like: "??????????????????". I have tried many things but nothing is working. The strange thing here is when i am using the same CFC for PDF reproduction, Greek characters output correctly. I'm straggling with this one 1 week now. Any ideas are welcomed.
    Thank you in advance,
    Tom, Greece


    The cfm file:
    
    <cfheader name="Content-Disposition" value="inline; filename=Save-Print.doc" charset="utf-8">
    <cfcontent type="application/msword">
    
    <html xmlns:o="urn:schemas-microsoft-com:office:office"
          xmlns:w="urn:schemas-microsoft-com:office:word" 
          xmlns="http://www.w3.org/TR/REC-html40">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Print</title>
    <!--[if gte mso 9]> 
    <xml>
    <w:WordDocument>
    <w:View>Print</w:View>
    <w:Compatibility>
    <w:UseAsianBreakRules/>
    </w:Compatibility>
    <w:Zoom>100</w:Zoom>
    <w:DoNotOptimizeForBrowser/>
    </w:WordDocument>
    </xml>
    <![endif]-->
    
    <!--[if supportFields]>
    <div style="mso-element:header" id="lala">
    <p class=MsoHeader><span style="color:red">
    <![endif]-->
    <style>
    <!--
    @page Section1
    {
    size:8.5in 11.0in;
    margin:1.0in 1.25in 1.0in 1.25in;
    mso-header-margin:.5in;
    mso-footer-margin:.5in; 
    mso-paper-source:0;
    mso-header:url("http://localhost:8500/BookLedger_Final/resources/cfScripts/Header.html") h1;
    mso-footer:url("http://localhost:8500/BookLedger_Final/resources/cfScripts/Header.html") f1;
    }
    div.Section1 {page:Section1;}
    p.MsoHeader {
    border-bottom-width: 1px;
    border-bottom-style: solid;
    border-bottom-color: #333;
    }
    p.MsoFooter {
    }
    -->
    </style>
    </head>
    
    <body>
    
    <cfif not IsDefined("URL.id")>
          <cfelseif not IsDefined("URL.model")>
    </cfif>
    
      <!--- Get print details --->
      <cfinvoke
        component="Print"
        method="myPrint"
        returnvariable="getMember"
        id="#URL.id#" 
        model="#URL.model#">
    
    
        <div class=Section1>
    
          <cfoutput query="getMember">
            <b id="lala">#Title#</b>
            <p style="color:##1c1c1c"><i>#Body#</i></p>
          </cfoutput>      
    
        </div> 
    
    
    </body>
    </html>
    
    Code (markup):
    The cfc file:
    
    <cfcomponent>
    
        <cffunction name="myPrint" access="remote" returntype="query" output="no">
    
            <cfargument name="id" default="0" required="false" type="numeric">
            <cfargument name="model" default="" required="false" type="any">
            <cfset model = #ARGUMENTS.model#>
    
            <cfif model EQ "member">
    
            <cfquery name="getMember" datasource="rental">            
                SELECT CONCAT(rental.members.firstname,' ',rental.members.lastname) AS 'Title',rental.members.biog AS 'Body'
                FROM rental.members
                WHERE rental.members.id = #ARGUMENTS.id#
                AND rental.members.model = "#ARGUMENTS.model#"
            </cfquery>
    
    
            <!---<cfset queryToString = serializeJson(getMember)>
            <cfset strippedQuery = REReplace(queryToString,'<[^>]*>','','all')>--->
    
            <cfreturn getMember>
    
    
    
            <cfelseif model EQ "new_member">
    
            <cfquery name="getMember" datasource="rental">            
                SELECT CONCAT(rental.new_members.firstname,' ',rental.new_members.lastname) AS 'Title',rental.new_members.biog  AS 'Body' 
                FROM rental.new_members
                WHERE rental.new_members.id = #ARGUMENTS.id#
                AND rental.new_members.model = "#ARGUMENTS.model#"
            </cfquery>
    
    Code (markup):
     
    anarchos78, Jun 1, 2012 IP