ServletFileUpload编码问题 [英] ServletFileUpload encoding issue
问题描述
我正在使用Apache commons fileupload API从UI上传文件。在文件中有一个条目如下:
I am using Apache commons fileupload API for uploading a file from UI. In the file there is a entry as given below:
<name>m²</name>
但加载文件后,角色变成下面的角色
But after loading the file, the character turning into below character
<name>m²</name>
我不知道在这里是否有编码的东西。指南请
I am not sure if there is something with encoding to do here. Guide please
推荐答案
出现上传的文件是XML。首先,文件应该是纯文本,并使用上标2的实体编码。理想情况下,< name>m²< / name>
应该是< name> m& ;#178;< / name> ,&#178;是上标2字。 xml处理器应该相应地翻译这个实体字符。
参考维基百科与ISO-8859-1 字符集,显示代码页布局部分中的字符图。
It appears the uploaded file is XML. In first place the file should be plain text and use entity encoding for superscript 2. Ideally <name>m²</name>
should be <name>m²</name>, where is ² is the superscript 2 character. The xml processors are supposed to translate this entity character accordingly.
The reference to Wikipedia with ISO-8859-1 charset that shows character chart under Codepage layout section.
这篇关于ServletFileUpload编码问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!