Saeed
Saeed

Reputation: 7370

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:
enter image description here
But the image which looks in my page, visited by firefox, is like:
enter image description here what should i do to fix this problem?

Upvotes: 0

Views: 141

Answers (1)

BalusC
BalusC

Reputation: 1108802

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.

Upvotes: 3

Related Questions