diff options
author | John Mark Bell <jmb@netsurf-browser.org> | 2009-02-20 12:50:34 +0000 |
---|---|---|
committer | John Mark Bell <jmb@netsurf-browser.org> | 2009-02-20 12:50:34 +0000 |
commit | 1f859400d962270ba418530e3a147004b4545963 (patch) | |
tree | 48a05d744ce6c778b80d60e2012333fbb13317ee /render/form.c | |
parent | 8bebcb5ca9d2760ff410a4c415a4f599ba9128fc (diff) | |
download | netsurf-1f859400d962270ba418530e3a147004b4545963.tar.gz netsurf-1f859400d962270ba418530e3a147004b4545963.tar.bz2 |
If we have no document charset on completion of parse, retrieve it from the binding.
Make the binding return Windows-1252 if it has no idea (as this is what the parser will have defaulted to).
Fix form_new to not require a document charset to be present -- it may not be known at this point.
Fixup form document charsets post-parse, so that form submission works correctly.
svn path=/trunk/netsurf/; revision=6575
Diffstat (limited to 'render/form.c')
-rw-r--r-- | render/form.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/render/form.c b/render/form.c index 096d5d3dd..c9f1abe24 100644 --- a/render/form.c +++ b/render/form.c @@ -50,7 +50,7 @@ static char *form_encode_item(const char *item, const char *charset, * \param target Target frame of form, or NULL for default * \param method method and enctype * \param charset acceptable encodings for form submission, or NULL - * \param doc_charset encoding of containing document + * \param doc_charset encoding of containing document, or NULL * \return a new structure, or NULL on memory exhaustion */ struct form *form_new(void *node, const char *action, const char *target, @@ -59,8 +59,6 @@ struct form *form_new(void *node, const char *action, const char *target, { struct form *form; - assert(doc_charset != NULL); - form = calloc(1, sizeof *form); if (!form) return NULL; @@ -88,8 +86,9 @@ struct form *form_new(void *node, const char *action, const char *target, return NULL; } - form->document_charset = strdup(doc_charset); - if (form->document_charset == NULL) { + form->document_charset = doc_charset != NULL ? strdup(doc_charset) + : NULL; + if (doc_charset && form->document_charset == NULL) { free(form->accept_charsets); free(form->target); free(form->action); |