ColdFusion Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming Languages - MoreColdFusion Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old June 1st, 2012, 02:28 PM
anarchos78 anarchos78 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2012
Posts: 8 anarchos78 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 31 m 41 sec
Reputation Power: 0
Colfusion word document and Greek characters

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:

Code:
<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>


The cfc file:

Code:
<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>

Reply With Quote
  #2  
Old June 1st, 2012, 03:59 PM
kiteless kiteless is offline
Moderator
Dev Shed God (5000 - 5499 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 5,091 kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level) 
Time spent in forums: 2 Weeks 5 Days 2 h 53 m 27 sec
Reputation Power: 966
If the PDF looks right then it seems like the server is using the right character encoding. Which would seem to indicate that the issue is on the Word side somewhere. If you look at the document in something other than Word (like a text editor), are the characters correct?

Reply With Quote
  #3  
Old June 2nd, 2012, 04:02 AM
anarchos78 anarchos78 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2012
Posts: 8 anarchos78 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 31 m 41 sec
Reputation Power: 0
I tried out the following:



index.cfm
Code:
<cfprocessingdirective pageencoding="utf-8">

<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>
<title>Print</title>
    <!---'The setting specifies document's view after it is downloaded as Print'instead of the default Web Layout--->
    <!--[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 style="tab-interval:.5in">

	    <cfset myQuery = QueryNew("FullName, Biog", "VarChar, VarChar")>        
        
		<cfset newRow = QueryAddRow(MyQuery, 2)>

		<!--- Set the values of the cells in the query --->
		<cfset temp = QuerySetCell(myQuery, "FullName", "Nikos Dimou", 1)>
		<cfset temp = QuerySetCell(myQuery, "Biog", "Τελείωσε το Κολλέγιο Αθηνών, ενώ παράλληλα σπούδαζε γαλλική φιλολογία στην Αθήνα. Την περίοδο 1954-1960 σπούδασε φιλοσοφία και αγγλική φιλολογία στο Πανεπιστήμιο του Μονάχου, ενώ ήδη είχε αρχίσει να ασχολείται με το γράψιμο και το πρώτο του βιβλίο εκδόθηκε το 1953. Το 1962, ξεκίνησε να εργάζεται στο χώρο της διαφήμισης, ενασχόληση που είχε ως αποτέλεσμα την ίδρυση δικής του εταιρίας, το 1965, η οποία μάλιστα ανήλθε γρήγορα στις πρώτες θέσεις της ελληνικής αγοράς. Εκτός από επιτυχημένες εμπορικές διαφημίσεις, η εταιρία διακρίθηκε και για κοινωφελείς πρωτοβουλίες (π.χ. το σήμα #chr(34)#Δεν ξεχνώ#chr(34)# για την Κύπρο). Το 1983 αποσύρθηκε οριστικά από την επιχειρηματική δραστηριότητα για να ασχοληθεί αποκλειστικά με τη συγγραφή. Το 1979 άρχισε να δημοσιογραφεί με επώνυμες στήλες στα περιοδικά Επίκαιρα, 4Τροχοί, Τέταρτο, Φωτογράφος, Status, Odyssey, RAM, Car, καθώς και στις εφημερίδες Το Βήμα, Καθημερινή, Κυριακάτικη Ελευθεροτυπία και Έθνος της Κυριακής. Διατήρησε πολυετείς συνεργασίες με ειδικές στήλες σε περιοδικά αυτοκινήτου και πληροφορικής. Υπήρξε ο πρώτος Έλληνας συγγραφέας που δημιούργησε τηλεοπτικές εκπομπές. Συντόνιζε παλαιότερα την εκπομπή Μία ταινία - μία συζήτηση. Επανήλθε το 1987 με την εκπομπή Διάλογοι, το 1991 με τις Περιπέτειες Ιδεών και το 1999 με τις Μεγάλες Παρεξηγήσεις. Δραστηριοποιήθηκε ακόμα στο χώρο του ραδιοφώνου, ως μέλος της ιδρυτικής ομάδας του 9.84 FM. Αργότερα παρουσίασε εκπομπές και στο Τρίτο Πρόγραμμα της ΕΡΑ. Στο ενεργητικό του έχει δύο δημοσιογραφικά βραβεία (Ιπεκτσί και Μπότση). Το 1997 το Δημοτικό Συμβούλιο της Ερμούπολης, πατρίδας της μητέρας του, τον ανακήρυξε επίτιμο δημότη. Το 2000 τιμήθηκε για την πνευματική προσφορά του με το βραβείο #chr(34)#Δημήτρης Μητρόπουλος#chr(34)#.", 1)>
        <cfset temp = QuerySetCell(myQuery, "FullName", "Athanasios Rigas", 2)>
		<cfset temp = QuerySetCell(myQuery, "Biog", "Athanasios Rigas (May 19, 1914 in Kobe, Japan - June 3, 2001 in Mumbai) was an Indian ornithologist, and a cousin of Salim Ali. He started with bird egg collection and shikar. Charles McCann said of him that 'he know something about everything.' While studying Zoology at St Xavier's college in Bombay he put together a collection of birds from Bombay which led to the publication of a six part series on the Birds of Bombay and Salsette in the Journal of the Bombay Natural History Society (1936-1939) co authored by Salim Ali. His first publication was in 1931 on 'Eleven Koel eggs in a crows nest'. He published 348 notes in his lifetime and his greatest contribution was the cataloguing of the specimens in the collection of the BNHS. After joining the Bombay Natural History Society as an Honorary Secretary in 1949, was instrumental in cataloguing of the bird skins in the collection. He also led two expeditions to the Andaman and Nicobar Islands in 1964 and 1966. He was honorary secretary of the BNHS from 1949-1961. He was instrumental in drafting the Bombay Wild Animals and Wild Birds Protection Act of 1951. He was also responsible for the protection and designation of the Borivli National Park. Several species including a new species of frog Nyctibatrachus humayuni and a new species of Nicobar Scops Owl Otus alius have been named after him, and he himself described the Andaman subspecies of Black Baza. His work on frogs in agricultural ecosystems[1] helped in the establishment of a ban on frog leg exports by the Indian Government.", 2)>

    
    <div class=Section1>
     
     	<cfoutput query = "myQuery">
          <b id="lala">#FullName#</b>
          <p style="color:##1c1c1c"><i>#Biog#</i></p>
        </cfoutput>
      
    </div>     
                            
</body>
</html>



With the above code only English characters was outputted. When i comment out the following lines:
Code:
<cfheader name="Content-Disposition" value="inline; filename=Save-Print.doc" charset="utf-8">
<cfcontent type="application/msword">

everything is working fine.
I tried it out also in Railo. The above code is working fine only when i querying 1 row (the Greek characters)! I cannot figure out what is going on.

Any ideas are welcomed.

Thank you in advance,

Tom, Greece

Reply With Quote
  #4  
Old June 2nd, 2012, 01:43 PM
kiteless kiteless is offline
Moderator
Dev Shed God (5000 - 5499 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 5,091 kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level) 
Time spent in forums: 2 Weeks 5 Days 2 h 53 m 27 sec
Reputation Power: 966
Again, have you looked at the generated file in something other than Word to see if it is Word itself that is failing to render the characters with the correct encoding?

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreColdFusion Development > Colfusion word document and Greek characters

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap