1

We have an application running Sun Glassfish app server with Java (JAXRS if it matters). Part of the application allows the web client to download an XML file with UTF8 encoding. (We need to support UTF8 for foreign languages.) The problem is that the downloaded files, when saved to disk, lack the proper BOM bytes at the beginning. My understanding of this is some editors (used subsequently to open the files) may not know for certain that the files are UTF8.

So the question is: what tells a browser/OS to save a downloaded file with the UTF8 BOM? Is it something in the http response header? Is it the xml declaration line that contains the encoding="UTF-8"? A combination of both? Thanks.

bethesdaboys
  • 1,797
  • 7
  • 22
  • 35

1 Answers1

1

response header:

Content-Type: text/xml; charset=utf-8

will do

i set my httpd to support utf-8 by default.

AddDefaultCharset UTF-8

ligerdave
  • 714
  • 2
  • 6
  • 13