Hi all,
I am using tutbine2.2 to build an application. The language is chinese.
I have a form(see the following). If I input chinese characters in the "Name" field
or other text fields,
I can't get the correct string on the server. If name of the files I upload is in
chinese, I can't get the name correctly.
I made 2 changes in turbine2.2 to solve the 2 problems.
(1) In org.apache.turbine.services.upload.TurbineUploadService.java, I replaced line
210 and 211 with the following codes,
try
{
params.append(getFieldName(headers),
new String(item.get(),"ISO8859_1"));
}
catch(UnsupportedEncodingException e)
{ }
(2) In org.apache.turbine.util.upload.MultipartStream.java, line 378, I replaced this
line with the following codes,
try
{
buf.append(new String(b,"ISO8859_1"));
}
catch(UnsupportedEncodingException e)
{ }
I think there should be another ways to solve these problems. Maybe we can only
store byte stream to ParameterParser
and let the users to do the encoding conversion. Maybe we should make the convertion
in turbine according to the
character information from the request.
$page.setTitle("Insert")
<form method="post" enctype="multipart/form-data"
action="$link.setPage("MessageIndex.vm").setAction("MessageAgent")">
<div align="left">
<table bgcolor="#ffffff" cellpadding="2">
<tr>
#formCell ("User" "user_id" "")
</tr>
<tr>
#formPasswordCell ("Password" "password" "")
</tr>
<tr>
#formCell ("Name" "name" "")
</tr>
<tr>
#formCell ("Root" "father_id" "")
</tr>
<tr>
#formCell ("Group" "cat_id" "")
</tr>
<tr>
##formCell ("Message" "body" "")
##<td>Message</td><td><textarea rows="10" name="body"
cols="80"></textarea></td>
#formTextAreaCell("Message" "body" "" "10" "80")
</tr>
<tr>
#fileUpload ("File" "filename")
</tr>
<tr>
#fileUpload ("Image" "image")
</tr>
</table>
<input type="submit" name="eventSubmit_doInsert" value="Insert"/>
</div>
</form>