Important Notice - Forums is archived
To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

TUTORIALVaadin lets you build secure, UX-first PWAs entirely in Java.
Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
Calling javascript synchronously by Enver Haase, 1 week ago
Кодировка файла при открытии в браузере
Здравствуйте.
Такой вопрос по кодировке файла. Для корректного отображения наименования для скачиваемого файла переопределяю метод
@Override
public DownloadStream getStream() {
final DownloadStream stream =
new DownloadStream(getStreamSource().getStream(), contentType, filename);
try {
stream.setParameter("Content-Disposition", "attachment; filename="+URLEncoder.encode(filename,"utf-8"));
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
// This magic incantation should prevent anyone from caching the data
stream.setParameter("Cache-Control", "private,no-cache,no-store");
// In theory <=0 disables caching. In practice Chrome, Safari (and, apparently, IE) all
// ignore <=0. Set to 1s
stream.setCacheTime(1000);
return stream;
}
Все работает корректно в браузере Chrome. Но firefox 3-9 не желает воспринимать utf-8.
Подскажите пожалуйста, надо ли указать какие то доп. параметры или как-то корректно настроить firefox?
Last updated on Feb, 24th 2012
You cannot reply to this thread.