From 1f859400d962270ba418530e3a147004b4545963 Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Fri, 20 Feb 2009 12:50:34 +0000 Subject: 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 --- render/hubbub_binding.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'render/hubbub_binding.c') diff --git a/render/hubbub_binding.c b/render/hubbub_binding.c index 79a3dba0f..b674d011c 100644 --- a/render/hubbub_binding.c +++ b/render/hubbub_binding.c @@ -139,7 +139,8 @@ binding_error binding_create_tree(void *arena, const char *charset, void **ctx) c->parser = NULL; c->encoding = charset; - c->encoding_source = ENCODING_SOURCE_HEADER; + c->encoding_source = charset != NULL ? ENCODING_SOURCE_HEADER + : ENCODING_SOURCE_DETECTED; c->document = NULL; c->owns_doc = true; c->forms = NULL; @@ -232,7 +233,7 @@ const char *binding_get_encoding(void *ctx, binding_encoding_source *source) *source = c->encoding_source; - return c->encoding; + return c->encoding != NULL ? c->encoding : "Windows-1252"; } xmlDocPtr binding_get_document(void *ctx) -- cgit v1.2.3