why does web server display images corrupterd?
I have a page in JSP, which has a tag like:
<img src="images/1.bmp"></img>
The 1.bmp is like:
I've converted the images which you uploaded into your question back to BMP and investigated their source. Everywhere where a non-ISO-8859-1 character appears in the original source, a ?
appears in the malformed source.
This means that you've a servlet on /images/*
which uses response.getWriter()
to write the image using the platform default charset. You shouldn't do that. BMP files are not text files. BMP files are binary files. You should be using response.getOutputStream()
to write binary data. You can find a basic and proper example of an image servlet in this article.
精彩评论