Problem with Spanish words!

Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.

  1. #1

    Default Problem with Spanish words!

    Hi,

    I have just added data to a data base and the data contains Spanish words.
    e.g. Vi?uela, V?lez-Malaga .
    Everything was working fine before I added this data but now there are
    problems when the words are used as links to other pages containing data.
    I think it is characters such as ? ? that are causing the following code to
    crash. The code is the standard code to divide results over a number of pages.

    Does anyone know why this is hapening and how I can correct it?
    I am using CF MX, MS Access

    Thanks,

    <cfset MaxRows_property=10>
    <cfset
    StartRow_property=Min((PageNum_property-1)*MaxRows_property+1,Max(property.Recor
    dCount,1))>
    <cfset
    EndRow_property=Min(StartRow_property+MaxRows_prop erty-1,property.RecordCount)>
    <cfset TotalPages_property=Ceiling(property.RecordCount/MaxRows_property)>

    <cfset QueryString_property=Iif(CGI.QUERY_STRING NEQ
    "",DE("&"&XMLFormat(CGI.QUERY_STRING)),DE("")) > <!--- THE ERROR POINTS TO THIS
    LINE --->

    <cfset
    tempPos=ListContainsNoCase(QueryString_property,"P ageNum_property=","&")>
    <cfif tempPos NEQ 0>
    <cfset QueryString_property=ListDeleteAt(QueryString_prop erty,tempPos,"&")>
    </cfif>

    cjdunkerley Guest

  2. Similar Questions and Discussions

    1. Need Help in Spanish
      :camera;Alguien en espa?ol porfavor mi direccion es :odee@trocha.cav.sld.cu .Gracias
    2. Spanish accents Using Mac
      I have found support for applying spanish accents on a PC, but what about on a Mac?
    3. Web services in spanish
      Try these directories: www.salcentral.com www.xmethods.com -- Greetz, Jan ________________________ Read my weblog:...
    4. Storing into mySQL Spanish words from an XML parse
      Hello. I'm using 'XML::Parser' to parse a XML file with Spanish characters. I would like to store data into a mySQL DataBase. XML::Parser uses...
    5. replace words with bold words
      Hello I was wondering if you guys could help me solve this using reg exp, i have a searchpage and a variable keywords that holds a number of...
  3. #2

    Default Re: Problem with Spanish words!

    what is the error? what exactly is being output?

    PaulH Guest

  4. #3

    Default Re: Problem with Spanish words!

    HI Paul,

    Error: Invalid CFML construct found on line 1 at column 21. ColdFusion was
    looking at the following text:<p>;</p><p>The CFML compiler was
    processing:<ul><li>An expression that began on line 1, column 17.<br>Your
    expression might be missing an ending "#" (it might look like #expr ).<li>an
    expression beginning with "\"", on line 1, column 1.This message is usually
    caused by a problem in the expressions structure.</ul> <br>The error occurred
    on line 70.<br>Page:
    /search_location.cfm&location=Almu?ecar&price_from= 0&price_to=999999999&buyrent=
    0&beds=0&propstyle=0<br>From: http://www.thegpg.com/search_results.cfm<br>Date:
    Wed Jun 22 09:54:58 BST 2005<br>Invalid Fields:
    #error.InvalidFields#<br>Browser: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT
    5.1; SV1; .NET CLR 1.1.4322)<br>

    It only happens on the links that have foreign characters in them.

    The output is a page showing property details and pictures in a list e.g.

    [url]http://www.thegpg.com/search_location.cfm?location=Almu?ecar&price_from= 0&price_[/url]
    to=999999999&buyrent=0&beds=0&propstyle=0

    We are going to be adding in data from all over the world so are foreign
    characters going to be a big problem for us?

    Regards,
    Chris.



    cjdunkerley Guest

  5. #4

    Default Re: Problem with Spanish words!

    let's back up a bit. if you intend on supporting many languages then you want
    unicode (utf-8) not iso-8859-1 as shown on that page
    (/www.thegpg.com/search....). i see you're not using euro symbols (it's not in
    iso-8859-1), again this is a small issue that using unicode can fix.

    i really can't see anything wrong w/your code (a re yoiu showing all of it or
    the right bits?). but a simple [url]http://www.sustainablegis.com/unicode/urls.cfm[/url]
    using my unicode test data seems to work w/your code

    <cfset QueryString_property=Iif(CGI.QUERY_STRING NEQ
    "",DE("&"&XMLFormat(CGI.QUERY_STRING)),DE("")) >

    as well as with unescaped url links.

    can you post the whole page?



    PaulH Guest

  6. #5

    Default Re: Problem with Spanish words!

    I have added this to application.cfm
    <setEncoding("url","utf-8")>
    <setEncoding("form","utf-8")>
    <cfcontent type="text/html; charset=utf-8">

    and put <cfprocessingdirective pageEncoding="utf-8"> on the top of the two
    search/results pages involved but I still get the error.

    I have added the page code that gets the error. This is a link to the page
    that links to this page code:

    [url]http://www.thegpg.com/search_results.cfm?id_area1=Costa%20Tropical&id_co untry=Sp[/url]
    ain&price_from=0&price_to=999999999&buyrent=0&beds =0

    If you have a look you can see the links with foreign characters are not
    working but the other ones do.
    (I have removed the error catching so the error code is visible)

    Thanks.

    <cfif not parameterexists(url.location)>
    <cflocation addtoken="no" url="propertysearch.cfm">
    </cfif>
    <cfprocessingdirective pageEncoding="utf-8">
    <cfparam name="url.propstyle" default="">
    <cfset CurrentPage=GetFileFromPath(GetTemplatePath())>
    <cfparam name="PageNum_property" default="1">

    <cfquery datasource="thegpg" name="property">
    SELECT PropertiesWOwner.id_location, PropertiesWOwner.price_from,
    PropertiesWOwner.price_to, PropertiesWOwner.*, Countries.Curr, Countries.Units
    FROM Countries INNER JOIN PropertiesWOwner ON Countries.id_country =
    PropertiesWOwner.id_country
    WHERE (
    <cfif #url.location# EQ '*'>
    PropertiesWOwner.country = '#url.country#' AND PropertiesWOwner.area =
    '#url.area#' AND
    <cfelse>
    ((PropertiesWOwner.location)='#url.location#') AND
    </cfif>
    (PropertiesWOwner.price_from) >= #url.price_from# And
    (PropertiesWOwner.price_from) <= #url.price_to#)
    <cfif #url.buyrent# EQ 'resale'>
    AND ((PropertiesWOwner.status)='r')
    AND sale_or_rent = 's'
    <cfset vbr = "sale">
    <cfset vbrs = "resale">
    <cfelseif #url.buyrent# EQ 'new'>
    AND ((PropertiesWOwner.status)='n')
    AND sale_or_rent = 's'
    <cfset vbr = "sale">
    <cfset vbrs = "new">
    <cfelseif #url.buyrent# EQ 'n_r'>
    AND ((PropertiesWOwner.status)='n')
    AND ((PropertiesWOwner.status)='r')
    AND sale_or_rent = 's'
    <cfset vbr = "sale">
    <cfset vbrs = "new and resale">
    <cfelseif #url.buyrent# EQ '0'>
    AND sale_or_rent = 's'
    <cfset vbr = "sale">
    <cfset vbrs = "new and resale">
    </cfif>
    <cfif #url.buyrent# EQ 'rent'>
    AND ((PropertiesWOwner.sale_or_rent)='r')
    <cfset vbr = "rent">
    <cfset vbrs = "">
    </cfif>
    <cfif #url.beds# NEQ 0>
    AND bed_from >= #url.beds#
    </cfif>
    <cfif parameterexists(url.propstyle) AND url.propstyle NEQ 0>
    <cfif #url.propstyle# NEQ 0>
    AND PropertiesWOwner.type Like '%#url.propstyle#%'
    </cfif>
    </cfif>
    ORDER BY price_from ASC
    </cfquery>

    <cfif #url.buyrent# EQ 'rent'>
    <cfset pType1 = 'Ren'>
    <cfelseif #url.buyrent# EQ 'new'>
    <cfset pType1 = 'New'>
    <cfelseif #url.buyrent# EQ 'n_r' OR #url.buyrent# EQ 0>
    <cfset pType1 = 'NewRes'>
    <cfelseif #url.buyrent# EQ 'resale'>
    <cfset pType1 = 'Res'>
    </cfif>

    <cfset MaxRows_property=10>
    <cfset
    StartRow_property=Min((PageNum_property-1)*MaxRows_property+1,Max(property.Recor
    dCount,1))>
    <cfset
    EndRow_property=Min(StartRow_property+MaxRows_prop erty-1,property.RecordCount)>
    <cfset TotalPages_property=Ceiling(property.RecordCount/MaxRows_property)>
    <cfset QueryString_property=Iif(CGI.QUERY_STRING NEQ
    "",DE("&"&XMLFormat(CGI.QUERY_STRING)),DE("")) >
    <cfset
    tempPos=ListContainsNoCase(QueryString_property,"P ageNum_property=","&")>
    <cfif tempPos NEQ 0>
    <cfset QueryString_property=ListDeleteAt(QueryString_prop erty,tempPos,"&")>
    </cfif>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html><!-- InstanceBegin template="/Templates/tempSearch1.dwt"
    codeOutsideHTMLIsLocked="false" -->
    <head>
    <!-- InstanceBeginEditable name="doctitle" -->
    <title>Property in <cfif url.location NEQ '*'>
    <cfoutput>#property.Location#</cfoutput>
    <cfelse>
    <cfoutput>#url.area#</cfoutput>
    </cfif></title>
    <!-- InstanceEndEditable -->
    <link href="gpg3_style.css" rel="stylesheet" type="text/css">
    <!-- InstanceBeginEditable name="head" -->
    <meta name="description" content="The Global Property Group, extensive
    porfolio of new, resale, renovation property/real estate from around the
    Globe.">
    <meta name="keywords" content="property, for, sale, new, re-sale, sale,
    turkey, bulgaria, spain, florida, france, cyprus, canary islands, villa,
    townhouse, apartment">
    <META NAME="author" CONTENT="info@thegpg.com">
    <META NAME="Robots" CONTENT="index,follow">
    <META NAME="revisit-after" CONTENT="4 days">
    <META NAME="rating" CONTENT="General">
    <META NAME= "distribution" CONTENT="Global">
    <meta http-equiv="content-language" CONTENT="en">
    <style type="text/css">
    <!--
    .style1 {color: #FFFFFF}
    -->
    </style>
    <!-- InstanceEndEditable -->
    <link rel="shortcut icon" href="http://www.thegpg.com/images/gpg_icon.ico">
    <cfquery name="Countries" datasource="thegpg">
    SELECT * FROM Countries WHERE id_country <> 103 </cfquery>
    <cfquery name="rsTotalProp" datasource="thegpg">
    SELECT ID FROM PropertiesWOwner </cfquery>
    <script language="javascript" src="js.js"></script>
    </head>
    <body onLoad="MM_preloadImages('images/headerbar.gif')">
    <div id="topText"><strong><!-- InstanceBeginEditable name="toptext"
    --><cfoutput><cfif url.propstyle NEQ '0'>#url.propstyle#
    </cfif>#property.Location# #vbrs# Property For #vbr# in
    #property.country#</cfoutput><!-- InstanceEndEditable --></strong></div>
    <div id="containerExt">
    <div id="SearchNavSearch"><!-- InstanceBeginEditable name="searchNav" -->
    <table width="100%" border="0" cellpadding="0" cellspacing="0">
    <tr>
    <td valign="middle" width="68%" class="Header">
    <h2 class="style1">
    <cfoutput>#property.country#</cfoutput> Property For <cfif pType1 EQ
    'New' or pType1 EQ 'Res' OR pType1 EQ 'NewRes'>Sale in <cfelseif pType1 EQ
    'Rent'> Rent in <cfelse> Sale and Rent
    in</cfif><cfoutput>#property.Location#</cfoutput>
    (<cfoutput>#property.RecordCount#</cfoutput>) </h2></td>
    <td width="32%" class="Header" align="right"><img
    src="images/icon_bar_Sloc.gif" border="0" usemap="#MapSL">
    <map name="MapSL">
    <area shape="circle" coords="82,11,10" href="#"
    alt="Currency Converter"
    onClick="MM_openBrWindow('http://www.moneycorp.co.uk/converter/cc_redirect.html'
    ,'CurrencyConverter','scrollbars=yes,width=580,hei ght=500')">
    <area shape="circle" coords="60,11,10" href="contact.cfm"
    alt="contact us or request a call back">
    <area shape="circle" coords="36,11,10"
    href="propertysearch.cfm" alt="new property search">
    <area shape="circle" coords="13,11,10" href="#"
    onClick="window.history.back()" alt="back">
    </map></td></tr>
    </table>
    <!-- InstanceEndEditable --></div>
    <div id="pageTextColSearch1Ext"><!-- InstanceBeginEditable name="PageWidth"
    -->
    <p><cfoutput>Records #StartRow_property# to #EndRow_property# of
    #property.RecordCount# </cfoutput></p>
    <table border="0" align="center">
    <cfoutput>
    <tr>
    <td width="23%" align="center"><cfif PageNum_property GT 1>
    <span class="text"><a
    href="#CurrentPage#?PageNum_property=1#QueryString _property#">First</a>
    </span>
    </cfif>
    </td>
    <td width="31%" align="center"><cfif PageNum_property GT 1>
    <span class="text"><a
    href="#CurrentPage#?PageNum_property=#Max(Decremen tValue(PageNum_property),1)##Q
    ueryString_property#">Previous</a>
    </span>
    </cfif>
    </td>
    <td width="23%" align="center"><cfif PageNum_property LT
    TotalPages_property>
    <span class="text"><a
    href="#CurrentPage#?PageNum_property=#Min(Incremen tValue(PageNum_property),Total
    Pages_property)##QueryString_property#">Next</a>
    </span>
    </cfif>
    </td>
    <td width="23%" align="center"><cfif PageNum_property LT
    TotalPages_property>
    <span class="text"><a
    href="#CurrentPage#?PageNum_property=#TotalPages_p roperty##QueryString_property#
    ">Last</a>
    </span>
    </cfif>
    </td>
    </tr>
    </cfoutput>
    </table>
    <br>
    <cfoutput query="property" startRow="#StartRow_property#"
    maxRows="#MaxRows_property#">
    <cfset D = ''>
    <div class="newDev">
    <table width="100%" class="Header" border="0" cellpadding="0"
    cellspacing="0">
    <tr>
    <td width="68%"><h3><span class="style1">#property.title#</span></h3>
    <td width="32%">
    <div align="right">
    <a href="propertydetail.cfm?id=#property.ID#">
    <img src="images/viewdetail_icon.gif" alt="View Property Details"
    width="23" height="23" border="0"></a>
    <a href="javascript:;"
    onclick="MM_openBrWindow('property_portfolio_add.c fm?fid=#property.ID#','Added',
    'width=350,height=150')"><img src="images/Portfolio_Icon.gif" alt="Add to
    favorites" width="23" height="23" border="0"></a>
    </div></td>
    </tr>
    </table><cfinclude template="imagepath.cfm">
    <div class="image">
    <cfif #property.img_main# EQ 'nopicture.jpg'>
    <a href="propertydetail.cfm?id=#property.ID#"><img align="middle"
    src="images/noimage.jpg" width="113" height="100" border="0"></a>
    <cfelse>
    <a href="propertydetail.cfm?id=#property.ID#"><img
    src="#path##property.img_main#" width="160" height="100" border="0"></a>
    </cfif></div>
    <cfif property.description NEQ ''>
    <cfset D = URLDecode(property.description)>
    <cfelseif #property.Headline# NEQ ''>
    <cfset D = property.Headline>
    <cfelseif #property.site_information# NEQ ''>
    <cfset D = property.site_information>
    <cfelseif #property.area_information# NEQ ''>
    <cfset D = URLDecode(property.area_information)>
    </cfif>
    <div class="description">
    <cfif D NEQ ''>
    <span class="blueText">#ParagraphFormat(D)#
    </span>
    </cfif></div>
    <div class="facs">
    <table width="100%"border="0" cellpadding="1" cellspacing="0">

    cjdunkerley Guest

  7. #6

    Default Re: Problem with Spanish words!

    well your pages all work for me, i just sent a message for the 1st property in
    Almu?ecar to test. i don't see anything funny in your code (but i'm just
    glancing thru it).....what broswer are you testing with? i'm using firefox.
    i'll see what happens w/ie.


    PaulH Guest

  8. #7

    Default Re: Problem with Spanish words!

    yeah it blows up in ie when you use the xmlFormat function (the unescaped
    unicode urls work ok on my testbed). maybe try this instead:

    URLEncodedFormat(CGI.QUERY_STRING,"utf-8")

    do you actually need/use XML?


    PaulH Guest

  9. #8

    Default Re: Problem with Spanish words!

    Thanks Paul,

    You have been a great help, I don't know how I would have solved that one! I
    don't think we need xml so I think it will work fine and now I know what to
    look for if there are any future problems.

    Regards,
    Chris.

    cjdunkerley Guest

  10. #9

    Default Re: Problem with Spanish words!

    actually i'd recommend maybe moving to session vars, etc. those URLs are going to get ugly.
    PaulH Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139