I have a simple jsp form that the customer uses to send us emails. Though on some occasions the emails come through incorrectly formatted with the text =?ISO-8859-1?Q?
sporadically displayed throughout the text of the email.
I know that ISO-8859-1 is a character encoding though I am not sure how this error is occurring and have been unable to reproduce this error. I have tried to fill out the form with different character encoding selected using Firefox but still cant reproduce. I have tried to use a laptop with Chinese Win XP language settings to fill out the form but also unable to reproduce this error.
Has anyone seen this error or have any ideas how I could reproduce this this?
Thanks for your comments - I am still looking for a way to reproduce this bug or a reason to why its happening,
the jsp code is straightforward (below) used within a portlet in weblogic 9
<%@ page language="java" contentType="text/html;charset=UTF-8"%>
<%@ taglib uri="/WEB-INF/struts-adapter-html.tld" prefix="html"%>
<%@ page import="java.lang.String" %>
<html:html>
<html:head>
<title>Feedback Form</title>
</html:head>
<html:body>
<html:form action="/emailFeedback">
<label>First name </label>
<html:text property="forename"/>
<label>Surname </label>
<html:text property="surname"/>
<label>telephone number </label>
<html:text property="telephonenumber"/>
<label>Zip code</label>
<html:text property="zipcode"/>
<label>DOB (MM/DD/YYYY)</label>
<html:text property="dob" />
<label>Email </label>
<html:text p开发者_StackOverflow中文版roperty="email"/>
<label>Confirm Email </label>
<html:text property="confirm_email"/>
<label>Subject</label>
<html:selectproperty="category">
<html:option value="">select > ></html:option>
<html:option value="Test1">Test1</html:option>
<html:option value="Test2">Test2 Payments</html:option>
<html:option value="Test3">Test3</html:option>
</html:select>
<html:textarea property="feedback" cols="40" rows="7" />
<input value="Submit your query" type="submit">
</html:form>
</html:body>
</html:html>
The email incorrect email format is below (cleaned of personal data!)
=?ISO-8859-1?Q?=0A=0A______firstname:=09=09tes?= =?ISO-8859-1?Q?t=0A______lastname:=09=09KRA=0A___?= =?ISO-8859-1?Q?___Email:=09=09sampleemail@yaho?= =?ISO-8859-1?Q?o.fr=0A______DOB:=09=09=09=0A______?= =?ISO-8859-1?Q?telephonenumber:=05=09454465465456=0A?= =?ISO-8859-1?Q?______zipcode:=09=09=0A______T?= =?ISO-8859-1?Q?hree_No:=09=0907533644972=0A______Feedback:_____=0A______h?= =?ISO-8859-1?Q?sample_test_with_underscores_linking_words?= =?ISO-8859-1?Q?9_14.97=sample_test_with_underscores_linking_words?=
A sample email with the correct formatting is below for reference:
firstnameame: John
last ame: Doe
email: john.doe@test.com
DOB: 01/02/1957
Telephone : 005465465465
ZIPCODE: 91210
Feedback:
Correctly formatted feedback.
The ISO-8859-1
encoding only covers the standard Latin characters, not Chinese. To cover Chinese as well as any other characters available at the world, better use UTF-8
.
Also see this article for more technical background information as well as several solutions how to configure your JSP/Servlet environment accordingly to use UTF-8
.
Hope this helps.
=?ISO-8859-1?Q?text?=
is MIME encoded-word syntax to indicate that text (between the last two ?s) is encoded in ISO-8859-1 quoted printable in a context where only ASCII would normally be allowed.
This syntax is typically used in email headers which are only allowed to be ASCII.
Without seeing the emails and the code that generates them, its a bit difficult to say where the problem is.
精彩评论