Charset now an optional string.

This commit is contained in:
2025-04-11 19:49:07 -04:00
parent 3407c98eec
commit 564567d389
7 changed files with 38 additions and 35 deletions

View File

@ -341,7 +341,8 @@ void Html_tag_open_form(DilloHtml *html, const char *tag, int tagsize)
DilloUrl *action;
DilloHtmlMethod method;
DilloHtmlEnc content_type;
char *charset, *first;
char *first;
std::optional< std::string > charset;
const char *attrbuf;
HT2TB(html)->addParbreak (9, html->wordStyle ());
@ -376,7 +377,6 @@ void Html_tag_open_form(DilloHtml *html, const char *tag, int tagsize)
if (!dStrAsciiCasecmp(attrbuf, "multipart/form-data"))
content_type = DILLO_HTML_ENC_MULTIPART;
}
charset = NULL;
first = NULL;
if ((attrbuf = a_Html_get_attr(html, tag, tagsize, "accept-charset"))) {
/* a list of acceptable charsets, separated by commas or spaces */
@ -395,7 +395,7 @@ void Html_tag_open_form(DilloHtml *html, const char *tag, int tagsize)
}
if (!charset)
charset = html->charset;
html->formNew(method, action, content_type, charset);
html->formNew(method, action, content_type, charset.has_value() ? charset.value().c_str() : nullptr );
dFree(first);
a_Url_free(action);
}
@ -604,7 +604,7 @@ void Html_tag_open_isindex(DilloHtml *html, const char *tag, int tagsize)
action = a_Url_dup(html->base_url);
html->formNew(DILLO_HTML_METHOD_GET, action, DILLO_HTML_ENC_URLENCODED,
html->charset);
html->charset.has_value() ? html->charset.value().c_str() : nullptr);
html->InFlags |= IN_FORM;
HT2TB(html)->addParbreak (9, html->wordStyle ());