Hi Shawn

Thanks for your reply.

I have tried to follow your solution but is not working.

Is true that tomcat 5.0.28 has a know bug for utf-8. But searching the web I
found some solutions, but seems don't work in jdbforms without change the
code of the framework itself.



This is the code of one of the .jsp pages with error:


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<%@ page language= "java" import="java.lang.*,java.util.*"
contentType="text/html;charset=UTF-8" %>
<%@ taglib uri="/WEB-INF/dbforms.tld" prefix="db" %>
<html xmlns:db="http://www.wap-force.com/dbforms";>
<head>
<db:base/>
<title>Single --- file: public_country_single.jsp</title>
<link href="dbforms.css" rel="stylesheet"/>
<SCRIPT>
<!--
function openWin(s) {
window.open(s,"littlewin","width=450,height=350,resizable=yes");
}
-->
</SCRIPT>
</head>
<script language="javascript"
     src=<%= "\"" +request.getContextPath() +
"/dbformslib/jscal/calendar.js\""%>>
</script>
<body class="clsPageBody">
<table align="center" border="0" width="100%" cellspacing="0"
cellpadding="1" class="clsMainMenuTable">
<tr>
<td>
<table border="0" width="100%" cellspacing="0" cellpadding="3"
class="clsMainMenuTable">
<tr class="clsMainMenuTableRow">
<td>
<span class="clsMainMenu">public.country</span>
</td>
<td class="clsMainMenu" align="right">
<a class="clsMainMenu" href="public_country_list.jsp">[List]</a>
<a class="clsMainMenu" href="menu.jsp">[Menu]</a>
<a class="clsMainMenu" href="logout.jsp">[Log out]</a>
</td>
</tr>
</table>
</td>
</tr>
</table>
<db:dbform multipart="true" autoUpdate="false"
followUp="/public_country_single.jsp" maxRows="1"
tableName="public.country">
<db:header/>
<db:errors/>
<db:body>
<%
request.setCharacterEncoding( "UTF-8");
%>
<table width="400" align="center" border="0">
<tr class="clsEvenDataTableRow">
<td style="font-weight: bold" align="left">countryid</td>
<td align="left">
<db:textField styleClass="clsInputStyle" size="2" fieldName="countryid"/>
</td>
</tr>
<tr class="clsOddDataTableRow">
<td style="font-weight: bold" align="left">country</td>
<td align="left">
<db:textField styleClass="clsInputStyle" size="30" fieldName="country"/>
</td>
</tr>
<tr class="clsEvenDataTableRow">
    <td style="font-weight: bold" align="center">
  <a href="javascript:openWin('<db:blobURL
 fieldName="flag"/>')">
 <img src="<db:blobURL fieldName="flag" defaultValue="spacer.gif"/>"
border="0" alt="(click to see full size)">
 </a>
 </td>
    <td align="left"> flag <br>
  <db:file fieldName="flag" accept="image/*" styleClass="clsInputStyle"/>
    </td>
</tr>
</table>
<br/>
<center>
<db:insertButton styleClass="clsButtonStyle" caption="Commit data into
public.country"/>
</center>
</db:body>
<db:footer>
<table border="0" align="center">
<tr>
<td align="right">
<db:navFirstButton styleClass="clsButtonStyle" style="width:90"
caption="&lt;&lt; First"/>
</td>
<td align="center">
<db:navPrevButton styleClass="clsButtonStyle" style="width:90" caption="&lt;
Previous"/>
</td>
<td align="center">
<db:navNextButton styleClass="clsButtonStyle" style="width:90" caption="Next
&gt;"/>
</td>
<td align="left">
<db:navLastButton styleClass="clsButtonStyle" style="width:90" caption="Last
&gt;&gt;"/>
</td>
</tr>
</table>
<table border="0" align="center">
<tr valign="middle">
<td colspan="3">
<hr/>
</td>
</tr>
<tr align="center">
<td align="center">
<db:updateButton styleClass="clsButtonStyle" style="width:90"
caption="Update"/>
</td>
<td align="center">
<db:deleteButton styleClass="clsButtonStyle" style="width:90"
caption="Delete"/>
</td>
<td align="center">
<db:navNewButton styleClass="clsButtonStyle" style="width:90"
caption="Insert new"/>
</td>
</tr>
</table>
</db:footer>
</db:dbform>
</body>
</html>


This other page don't have any error:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<%@ taglib uri="/WEB-INF/dbforms.tld" prefix="db" %>
<[EMAIL PROTECTED] contentType="text/html;charset=UTF-8"%>
<html xmlns:db="http://www.wap-force.com/dbforms";>
<head>
<db:base/>
<title>Single --- file: public_tour_single.jsp</title>
<link href="dbforms.css" rel="stylesheet"/>
<SCRIPT>
<!--
function openWin(s) {
window.open(s,"littlewin","width=450,height=350,resizable=yes");
}
-->
</SCRIPT>
</head>
<script language="javascript"
                           src=<%= "\"" +request.getContextPath() +
"/dbformslib/jscal/calendar.js\""%>>
                </script>
<body class="clsPageBody">
<table align="center" border="0" width="100%" cellspacing="0"
cellpadding="1" class="clsMainMenuTable">
<tr>
<td>
<table border="0" width="100%" cellspacing="0" cellpadding="3"
class="clsMainMenuTable">
<tr class="clsMainMenuTableRow">
<td>
<span class="clsMainMenu">public.tour</span>
</td>
<td class="clsMainMenu" align="right">
<a class="clsMainMenu" href="public_tour_list.jsp">[List]</a>
<a class="clsMainMenu" href="menu.jsp">[Menu]</a>
<a class="clsMainMenu" href="logout.jsp">[Log out]</a>
</td>
</tr>
</table>
</td>
</tr>
</table>
<db:dbform multipart="true" autoUpdate="false"
followUp="/public_tour_single.jsp" maxRows="1" tableName="public.tour" >
<db:header/>
<db:errors/>
<db:body>
<table width="400" align="center" border="0">
<tr class="clsOddDataTableRow">
<td style="font-weight: bold" align="left">tour</td>
<td align="left">
<db:textField styleClass="clsInputStyle" size="40" fieldName="name"/>
</td>
</tr>
<tr class="clsEvenDataTableRow">
  <td style="font-weight: bold" align="left">country</td>
  <td align="left"><db:select fieldName="countryid"
styleClass="clsInputStyle"
customEntry=",<-------------------->"><db:queryData
   name="countries"
   query="select countryid, country from public.country order by country"/>
</db:select></td>
</tr>
<tr class="clsOddDataTableRow">
<td style="font-weight: bold" align="left">duration</td>
<td align="left">
<db:textField styleClass="clsInputStyle" size="15" fieldName="duration"/>
</td>
</tr>
<tr class="clsEvenDataTableRow">
<td align="left" class="clsEvenDataTableRow" style="font-weight:
bold">pickup-time</td>
<td align="left">
<db:textField styleClass="clsInputStyle" size="15" fieldName="pickup_time"/>
</td>
</tr>
<tr class="clsOddDataTableRow">
  <td align="left" style="font-weight: bold">days before reservation </td>
  <td align="left" class="clsOddDataTableRow"><db:textField
styleClass="clsInputStyle" size="5"
fieldName="days_before_reservation"/></td>
</tr>
<tr class="clsEvenDataTableRow">
    <td style="font-weight: bold" align="center">
  <a href="javascript:openWin('<db:blobURL
 fieldName="picturesmall"/>')">
 <img src="<db:blobURL fieldName="picturesmall" defaultValue="spacer.gif"/>"
border="0" width="60"
 height="60" alt="(click to see full size)">
 </a>
 </td>
    <td align="left">   Foto Peque&ntilde;a: <br>
  <db:file fieldName="picturesmall" accept="image/*"
styleClass="clsInputStyle"/>
    </td>
  </tr>
<tr class="clsOddDataTableRow">
    <td style="font-weight: bold" align="center">
  <a href="javascript:openWin('<db:blobURL
 fieldName="picturebig"/>')">
 <img src="<db:blobURL fieldName="picturebig" defaultValue="spacer.gif"/>"
border="0" width="60"
 height="60" alt="(click to see full size)">
 </a>
 </td>
    <td align="left">     Foto Grande: <br>
  <db:file fieldName="picturebig" accept="image/*"
styleClass="clsInputStyle"/>
    </td>
  </tr>

</table>
<br/>
<br/>
<br/>
<!-- table embedding the sub form -->
<table align="center" border="1">
  <tr>
    <td> <center>
        <p><b>Temporadas</b></p>
      </center>
      <!-------- sub form begin ------->
      <db:dbform tableName="public.tour_season" maxRows="7" parentField="id"
childField="tourid" followUp="/public_tour_single.jsp" autoUpdate="false"
captionResource="true">
      <!-- code for showing existing orders of services for that
customer -->
      <table>
   <db:header>
        <tr>
          <td width="40"></td>
          <td>Inicio <br/>
            [D&iacute;a/Mes/A&ntilde;o]</td>
          <td>Fin <br/>
            [D&iacute;a/Mes/A&ntilde;o]</td>
          <td width="80">Precio </td>
          <td width="50">Moneda </td>

<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</td>
        </tr></db:header>
        <db:body allowNew="false">
        <tr>
          <td width="40" valign="top"><db:associatedRadio name="radio_order"
/></td>
          <td valign="top"><db:dateField styleClass="clsInputStyle"
size="10" fieldName="startdate"  useJsCalendar="true"/>
          </td>
          <td valign="top"><db:dateField styleClass="clsInputStyle"
size="10" fieldName="enddate"  useJsCalendar="true"/>
          </td>
    <td colspan="4">
    <table width="100%">
    <db:dbform tableName="public.tour_season_price" parentField="seasonid"
childField="seasonid" followUp="/public_tour_single.jsp" autoUpdate="false">
    <db:body allowNew="false">
    <tr>
    <td width="80">
    <db:textField styleClass="clsInputStyle" size="8" fieldName="price"/>
    </td>
    <td>
    <db:select fieldName="currencyid" styleClass="clsInputStyle"
style="width:70px;" customEntry=",<---->"> <db:queryData
      name="currencies"
      query="select id, name from public.currency"/> </db:select>
    </td>
    <td align="right"><db:deleteButton caption="X"
styleClass="clsButtonStyle" style="width:20"/><db:updateButton caption="~"
styleClass="clsButtonStyle" style="width:20"/></td>
    </tr>
    </db:body>
    <db:footer>
    <tr>
    <td>
    <db:textField styleClass="clsInputStyle" size="8" fieldName="price"/>
    </td>
    <td>
    <db:select fieldName="currencyid" styleClass="clsInputStyle"
style="width:70px;" customEntry=",<---->"> <db:queryData
      name="currencies"
      query="select id, name from public.currency"/> </db:select>
    </td>
    <td align="right"><db:insertButton showAlways="true" caption="+"
styleClass="clsButtonStyle" style="width:20"/></td>
    </tr>
    </db:footer>    </db:dbform>
    </table>
    </td>
    <td><db:updateButton caption="~" styleClass="clsButtonStyle"
style="width:20"/></td>
        </tr>
        </db:body> <db:footer>
        <tr>
          <td width="40"></td>
          <td colspan="6" align="center"><br><db:updateButton
caption="Actualizar Temporada" associatedRadio="radio_order"
styleClass="clsButtonStyle"/>
          <db:deleteButton caption="Eliminar Temporada"
associatedRadio="radio_order" styleClass="clsButtonStyle"/><br></td>
        </tr>
      </table>
      <!-- code for entering new orders and services -->
      <br>
      <hr>
      <table>
        <tr>
          <td>Inicio <br/>
            [D&iacute;a/Mes/A&ntilde;o]</td>
          <td>Fin <br/>
            [D&iacute;a/Mes/A&ntilde;o]</td>
          <td colspan="2">&nbsp;</td>
        </tr>
        <tr>
          <td valign="top"><db:dateField styleClass="clsInputStyle"
size="10" fieldName="startdate"  useJsCalendar="true"/>
          </td>
          <td valign="top"><db:dateField styleClass="clsInputStyle"
size="10" fieldName="enddate"  useJsCalendar="true"/>
          </td>
          <td><db:insertButton showAlways="true" styleClass="clsButtonStyle"
caption="Insert Temporada"/></td>
        </tr>
      </table>
      <br>
   <center>
        <db:navFirstButton styleClass="clsButtonStyle" style="width:90"
caption="button.nav.first" /> <db:navPrevButton styleClass="clsButtonStyle"
style="width:90" caption="button.nav.previous" />
        <db:navNextButton styleClass="clsButtonStyle" style="width:90"
caption="button.nav.next" /> <db:navLastButton styleClass="clsButtonStyle"
style="width:90" caption="button.nav.last" />
      </center><br></db:footer>
      </db:dbform>
      <!-------- sub form end -------->
    </td>
  </tr>
</table>
<br/>
<center>
<db:insertButton showAlways="false" styleClass="clsButtonStyle"
caption="Commit data into public.tour"/>
</center>
</db:body>
<db:footer>
<table border="0" align="center">
<tr>
<td align="right">
<db:navFirstButton styleClass="clsButtonStyle" style="width:90"
caption="&lt;&lt; First"/>
</td>
<td align="center">
<db:navPrevButton styleClass="clsButtonStyle" style="width:90" caption="&lt;
Previous"/>
</td>
<td align="center">
<db:navNextButton styleClass="clsButtonStyle" style="width:90" caption="Next
&gt;"/>
</td>
<td align="left">
<db:navLastButton styleClass="clsButtonStyle" style="width:90" caption="Last
&gt;&gt;"/>
</td>
</tr>
</table>
<table border="0" align="center">
<tr valign="middle">
<td colspan="3">
<hr/>
</td>
</tr>
<tr align="center">
<td align="center">
<db:updateButton styleClass="clsButtonStyle" style="width:90"
caption="Update"/>
</td>
<td align="center">
<db:deleteButton styleClass="clsButtonStyle" style="width:90"
caption="Delete"/>
</td>
<td align="center">
<db:navNewButton styleClass="clsButtonStyle" style="width:90"
caption="Insert new"/>
</td>
</tr>
</table>
</db:footer>
</db:dbform>
</body>
</html>


This is the dbforms-config fragment:

<table name="public.country"
             defaultVisibleFields="countryid" >
  <field name="countryid" fieldType="char" size="2" isKey="true"/>
  <field name="country" fieldType="varchar" size="255"/>
  <field name="flag" fieldType="diskblob"
directory="/home/asvolymp/public_html/site/ROOT/images/flags"
encoding="false"/>

  <!-- add "granted-privileges" element for security constraints -->

 </table>

<table name="public.tour"
    defaultVsibleFields="id" >
  <field name="id" fieldType="int" isKey="true" autoInc="true" />
  <field name="name" fieldType="varchar" size="255" />
  <field name="countryid" fieldType="char" size="2" />
  <field name="duration" fieldType="varchar" size="255" />
  <field name="pickup_time" fieldType="time" size="8" />
  <field name="picturesmall" fieldType="diskblob"
directory="/home/asvolymp/public_html/site/ROOT/images/tours"
encoding="false"/>
  <field name="picturebig" fieldType="diskblob"
directory="/home/asvolymp/public_html/site/ROOT/images/tours"
encoding="false"/>
  <field name="days_before_reservation" fieldType="int" size="4" />

  <!-- add "granted-privileges" element for security constraints -->

 </table>

 <table name="public.tour_description">
  <field name="tourid" fieldType="int" size="4" isKey="true" />
  <field name="languageid" fieldType="char" size="2" isKey="true"/>
  <field name="name" fieldType="varchar" size="255" />
  <field name="description" fieldType="char" size="-1"/>
  <field name="includes" fieldType="char" size="-1"/>
  <field name="notincludes" fieldType="char" size="-1"/>
  <field name="suggested_equipments" fieldType="char" size="-1"/>

  <!-- add "granted-privileges" element for security constraints -->

 </table>

dbconnection
    id                      = "simple"
    isJndi                  = "false"
    isPow2                  = "true"
    connectionProviderClass =
"org.dbforms.conprovider.SimpleConnectionProvider"
    connectionPoolURL       = ""
    conClass                = "org.postgresql.Driver"
    name                    =
"jdbc:postgresql://localhost:5432/dbname?charSet=UTF-8"
    username                = "user"
    password                = "pass"/>




This is the web.xml fragment:

<filter>
       <filter-name>Set Character Encoding</filter-name>

<filter-class>org.dbforms.util.external.SetCharacterEncodingFilter</filter-c
lass>
     <init-param>
         <param-name>encoding</param-name>
         <param-value>UTF-8</param-value>
     </init-param>
   </filter>

   <filter-mapping>
     <filter-name>Set Character Encoding</filter-name>
       <url-pattern>/*</url-pattern>
   </filter-mapping>


How can this be configured to work ? I can fine the solution.

I have been searching in the internet:

http://marc.theaimsgroup.com/?l=tomcat-user&m=105532850031181&w=2
http://www.junlu.com/msg/111961.html


Thanks for all the help !!!

Regards

Miguel Fung

----- Original Message ----- 
From: "Shawn" <[EMAIL PROTECTED]>
To: "Lázaro Miguel Fung" <[EMAIL PROTECTED]>; "dbf"
<[EMAIL PROTECTED]>
Sent: Monday, October 11, 2004 5:39 PM
Subject: Re: [dbforms] Very strange behavior


> On Tue, 2004-10-12 at 00:12, Lázaro Miguel Fung wrote:
> > Hi,
> >
> > I got running a jdbforms app version 2.5 snapshot, the app use
postgresql
> > database and using utf-8 character encoding.
> >
> > The problem is that I'm moving to the production server, and some pages
> > report: can not convert uft-8 to iso8859-1, but some others not. I don't
> > think this is a postgresql bug, because is the same version, and the
same
> > database. The only diference is the tomcat/apache version:
> > - development: tomcat 4.1 / apache 2.4
> > - production: tomcat 5.028 / apache 1.3
> Does adding this help?
> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
>
> Are you using JSTL -- setLocale ?  If so, that maybe a problem.
> (see
>
http://weblogs.java.net/blog/simongbrown/archive/2004/03/displaying_inte.html)
>
> It's likely the filter we are using for tomcat and not dbforms itself.
> The filter, which I assume you use should deal with the following"...
>
> "Most browsers don't appear to send
> back a charset in the request that corresponds to the encoding that was
> used
> to format the page. In this case, the request character encoding
> defaults to
> ISO-8859-1 meaning that there's potentially a mismatch between form data
> being sent (in UTF-8) and information retrieved from the request (in
> ISO-8859-1) using the getParameter() method on the HttpServletRequest
> class.
> To fix this, all you need to do is explicitly set the character encoding
> of
> the request before accessing data.
>
> request.setCharacterEncoding("UTF-8");"
>
>   I read some on the Tomcat mailing list sometime ago that the timing of
> when the charactorEncoding was set changed.  I can recall the details
> but think you need to have request.setCharacterEncoding("UTF-8"); called
> earlier or it will be set to a default value automatically and then your
> attempt to set it later will be ignored.
>
> I did not have the problem myself and just read about it so am not 100%
> sure but definately you should search for " setCharacterEncodingtomcat
> error" or something like that.
>
> Otherwise,
> if the filter provided by dbforms is not working, I would look for
> another.  There should be one in the Tomcat version you have.
>
>
> -- 
> Shawn <[EMAIL PROTECTED]>
>
>
>
>




-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
Use IT products in your business? Tell us what you think of them. Give us
Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl
_______________________________________________
DbForms Mailing List

http://www.wap-force.net/dbforms

Reply via email to