【发布时间】:2011-07-19 15:50:42
【问题描述】:
当用户在 EditTextbox 中输入值“Nedskräpning”时,它会在数据库中保存为“Nedskräpning”。所以我假设这个错误是从应用程序的 Android 部分生成的。更新:
<EditText android:id="@+id/commentTextBox"
android:layout_height="fill_parent"
android:layout_width="fill_parent"
android:layout_weight="1"/>
java代码:
commentTextBox = (EditText) findViewById(R.id.commentTextBox);
crapport.setComment(commentTextBox.getText().toString());
然后这个crapport被保存在数据库中。
关于如何解决这个问题的任何提示?
更新:这是我的 Apache CXF 网络服务:
@Path("/crapportService/")
public class CrapportServiceImpl implements CrapportService {
@Autowired
private CrapportController crapportController;
@Override
@Path("image")
@POST
@Produces(MediaType.TEXT_HTML)
public String addReport(MultipartBody multipartBody) {
List<Attachment> attachmentList = new ArrayList<Attachment>();
attachmentList = multipartBody.getAllAttachments();
if (attachmentList.size() == 0){
return "No attachments";
}
try {
crapportController.processReportFromClient(attachmentList);
} catch (FileNotFoundException e) {
e.printStackTrace();
return "Error: FileNotFoundException";
} catch (NullPointerException e) {
return "Error: NullPointerException";
} catch (IOException e) {
return "Error: IOException";
}
return "Success";
}
}
【问题讨论】:
标签: android mysql utf-8 character-encoding