Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Weblogic Problem encoding file MS Word

Status
Not open for further replies.

giugy

Programmer
Sep 25, 2007
2
IT
Hi, i'm new in this forum...sorry for my english but i don't speak it very well...

I have a problem with encoding of a MS Word file.....I have this file stored in a DB Oracle like a BLOB...then I extract this file and I obtain the bytes of this file....than i write this byte in my ServletOutputStream so that i can see this word document from my jsp page in word format....until now everithing is ok...MS Word is open....but in the file the character are not encoded....are like this
"ÐÏ à¡± á ÿÿÿÿÿÿÿÿÿÿ "....... why i can't see it correctly???
What I don't understand is thas:
1)in the same page with a pdf (even this extract as byte from oracle column BLOB) works fine
2)with the same web application deployed on a tomcat server everithings work fine (with doc,xls....)
3)I think that every settings is ok....
in the jsp file
response.setContentType("application/msword");
response.setHeader("Content-Disposition", "attachment; filename=test.doc");

in web.xml
<mime-mapping>
<extension>doc</extension>
<mime-type>application/msword</mime-type>
</mime-mapping>

in weblogic.xml (I have read this in a forum)
<jsp-descriptor>
<jsp-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</jsp-param>
<jsp-param>
<param-name>compilerSupportsEncoding</param-name>
<param-value>false</param-value>
</jsp-param>
</jsp-descriptor>


The file that i obtain is not encode but is corret....infact if i make a compare (with a program "Beyond Compare" that meka a compare with the character not encoded like "ÐÏ à¡± á ÿÿÿÿÿÿÿÿÿÿ ") between the file that I obtain and the original file....everithing is equal...so the file is ok....but i can't open this correctly and visualize it correctly in word format!

Please help me.....thanks so much
 
Maybe it's a browser issue. What happens if you save the file to the disk and open it with MS Word?

Cheers,
Dian
 
I got a similar problem, and I solved it using a servlet instead of a jsp, because the jsp file writes some characters to out (for each page import it writes a new line, at the beginning).
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top