1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-11-04 08:17:17 -05:00

show_http_error_document: Generate a charset parameter.

This commit is contained in:
Kalle Olavi Niemitalo 2007-03-20 10:27:21 +02:00 committed by Kalle Olavi Niemitalo
parent 9a8fa9d7db
commit 3c6c79a637

View File

@ -169,8 +169,21 @@ show_http_error_document(struct session *ses, void *data)
if (cache) str = get_http_error_document(term, info->uri, info->code); if (cache) str = get_http_error_document(term, info->uri, info->code);
if (str) { if (str) {
/* The codepage that _("foo", term) used when it was
* called by get_http_error_document. */
const int gettext_codepage
= get_opt_codepage_tree(term->spec, "charset");
if (cached) delete_entry_content(cache); if (cached) delete_entry_content(cache);
/* If we run out of memory here, it's perhaps better
* to display a malformatted error message than none
* at all. */
mem_free_set(&cache->content_type, stracpy("text/html")); mem_free_set(&cache->content_type, stracpy("text/html"));
mem_free_set(&cache->head,
straconcat("\r\nContent-Type: text/html; charset=",
get_cp_mime_name(gettext_codepage),
"\r\n", (unsigned char *) NULL));
add_fragment(cache, 0, str, strlen(str)); add_fragment(cache, 0, str, strlen(str));
mem_free(str); mem_free(str);