2 Replies Latest reply on Feb 28, 2008 3:48 PM by romain.dev.easycity.com

    Problem with getting a string with accents

    romain.dev.easycity.com

      Hi guys,


      I'm using seam 1.2.1 GA and jboss 4.0.5 GA.


      I'm trying pass a String parameter to another page using http.


      On the first page, I have a list of cities (some of them contain accents). For exemple, in spain :


      VALÈNCIA


      I have this link (using facelets) :


      <a href="/sitemap/city.seam?country_code=#{city[1]}&amp;city_name=#{city[0]}">#{city[0]}</a>
      



      This is the generated URL :


      http://localhost:8080/sitemap/city.seam?country_code=es&city_name=VAL%C3%88NCIA
      




      Then I try to get the value for another query in my session bean :



          <page view-id="/sitemap/city.xhtml" action="#{siteMapManager.initCategoryList}">
               <param name="country_code" value="#{iso3166}"/>
               <param name="city_name" value="#{cityName}"/>
          </page>
      



      @In (required=false)
      private String cityName;



      An then trying to perform a query using the city name :



      // Get Category list
      String qCtgListStr =     "SELECT DISTINCT poi.mainCategory.id " +
      ", ctgDet.name " +
      ", poi.address.locality " +
      ", LOWER(poi.country.iso3166) " +
      ", COUNT (poi.id) " +
      "FROM POI as poi " +
      " INNER JOIN poi.mainCategory as ctg " +
      " INNER JOIN ctg.detailsSet as ctgDet " +
      "WHERE poi.revisionState = :revState " +               "          AND ctgDet.locale.id = :locale " +
      "          AND poi.country.iso3166 = :countryCode " +
      "          AND poi.address.locality = :cityName " +     "GROUP BY poi.mainCategory.id " +
      ",     ctgDet.name " +
      ",     poi.address.locality " +
      ",     poi.country.iso3166 " +
      "ORDER BY COUNT (poi.id) DESC";
      
      Query qCtgList = this.em.createQuery(qCtgListStr);
      qCtgList.setParameter("countryCode", this.iso3166.toUpperCase());
      qCtgList.setParameter("locale", this.locale.toString());
      qCtgList.setParameter("cityName", this.cityName);
      qCtgList.setParameter("revState", RevisionState.ACT);
      
      this.categorySet = qCtgList.getResultList();



      Howerver, I there is an accent issue. The query doesn't use VALÈNCIA with the correct accent.


      Do you know how can I do that correctly ?


      Thanks in advance.


      Romain