Hi David,
I can't really comment on most of your query, but I notice that the form
in your JSP has the 'enctype="multipart/form-data"' attribute, but the
equivalent VM page doesn't appear to have the same attribute. Might that
be causing the difference?
- simon
David Sperling wrote:
After working on this for a couple days I've got some
new info:
1. clicking submit from the jsp and vm pages causes
request.getContentType()) to produce the following:
working jsp: multipart/form-data; boundary=...
broken vm: null
2. velocity log shows the following:
[info] VelocityViewServlet: Default content-type is:
text/html; charset=UTF-8 but Action classes report
null as ContentType
3. Can fix the problem with:
OutdoorReservationForm outdoorReservation =
(OutdoorReservationForm) form;
String raw = outdoorReservation.getEvent();
String clean = new
String(raw.getBytes("ISO-8859-1"), "UTF-8");
But it would be too time consuming to do this on each
and every form attribute.
Any ideas on how to fix my velocity submissions so I
don't have to convert form attributes 1 by 1?
Cheers,
David
--- David Sperling <[EMAIL PROTECTED]> wrote:
Hi-
I'm usualy pretty good at fixing encoding problems
but
this one has me stumped.
I made the following test pages that link to struts
action. The jsp doesn't turn my UTF-8 japanese to
garbage but my velocity page does.
I'm using a UTF-8 filter in my web.xml:
<!-- Example filter to set character encoding on
each
request -->
<filter>
<filter-name>Set Character
Encoding</filter-name>
<filter-class>com.mydomain.coupon.filters.SetCharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
</filter>
<!-- Example filter mapping to apply the "Set
Character Encoding" filter
to *all* requests processed by this web
application -->
<filter-mapping>
<filter-name>Set Character
Encoding</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
Then I set the velocity.properties file to UTF-8:
#----------------------------------------------------------------------------
# T E M P L A T E E N C O D I N G
#----------------------------------------------------------------------------
#input.encoding=ISO-8859-1
#output.encoding=ISO-8859-1
input.encoding=UTF-8
output.encoding=UTF-8
default.contentType=text/html; charset=UTF-8
Here are my test pages:
#Not working Velocity Page
$request.setCharacterEncoding("UTF-8")
<html>
<head>
<TITLE>Velocity Test Page</TITLE>
<META http-equiv=Content-Type content="text/html;
charset=UTF-8">
</head>
<body bgcolor="#ffffff">
<form
action="$link.setAction('AddOutdoorReservation')" >
<table border="0" cellspacing="5"
cellpadding="0" align="center">
<tr>
<td nowrap>email</td>
<td><input type="text"
name="email"
size="24" tabindex="1" accesskey="1"></td>
</tr>
<tr>
<td nowrap>Outdoor Event Form
Menu</td>
<td>
<select name="event" size="1"
tabindex="3">
<option value="select"
selected>Outdoor Form Event</option>
<option>��ե��ƥ���</option>
</select>
</td>
</tr>
</table>
<br>
<input type="submit"
name="submitButtonName" value="Submit" tabindex="7">
</form>
</body>
</html>
# Working JSP Page
<[EMAIL PROTECTED] contentType="text/html; charset=UTF-8" %>
<%@ taglib uri="/tags/struts-tiles" prefix="tiles"
%>
<%@ taglib uri="/tags/struts-html" prefix="html" %>
<%@ taglib uri="/tags/struts-logic" prefix="logic"
%>
<%@ taglib uri="/tags/struts-bean" prefix="bean" %>
<% request.setCharacterEncoding("UTF-8"); %>
<html:html locale="true">
<head>
<TITLE>JSP Test Page</TITLE>
<META http-equiv=Content-Type content="text/html;
charset=UTF-8">
</head>
<body bgcolor="#ffffff">
<html:form action="/AddOutdoorReservation.do"
enctype="multipart/form-data">
<table border="0" cellspacing="5"
cellpadding="0" align="center">
<tr>
<td nowrap>email</td>
<td><html:text size="32"
property="email"/></td>
</tr>
<tr>
<td nowrap>Outdoor Event Form
Menu</td>
<td>
<select name="event" size="1"
tabindex="3">
<option value="select"
selected>Outdoor Form Event</option>
<option>��ե��ƥ���</option>
</select>
</td>
</tr>
</table>
<br>
<input type="submit"
name="submitButtonName" value="Submit" tabindex="7">
</html:form>
</body>
</html:html>
Any ideas or pointers would be greatly appreciated:
Cheers,
David
__________________________________
Do you Yahoo!?
Yahoo! Small Business - Try our new Resources site
http://smallbusiness.yahoo.com/resources/
---------------------------------------------------------------------
To unsubscribe, e-mail:
[EMAIL PROTECTED]
For additional commands, e-mail:
[EMAIL PROTECTED]
__________________________________
Do you Yahoo!?
Yahoo! Small Business - Try our new Resources site
http://smallbusiness.yahoo.com/resources/
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]