From 9e52f105293de75402f76266ac6987e1c839965e Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Wed, 7 Apr 2010 13:12:27 +0000 Subject: Add encoding source getter. svn path=/trunk/netsurf/; revision=10269 --- render/html.c | 16 ++++++++++++++++ render/html.h | 1 + 2 files changed, 17 insertions(+) diff --git a/render/html.c b/render/html.c index 760df52b9..880a92a3a 100644 --- a/render/html.c +++ b/render/html.c @@ -2035,6 +2035,22 @@ const char *html_get_encoding(hlcache_handle *h) return c->data.html.encoding; } +/** + * Retrieve the charset of an HTML document + * + * \param h Content to retrieve charset from + * \return Pointer to charset, or NULL + */ +binding_encoding_source html_get_encoding_source(hlcache_handle *h) +{ + struct content *c = hlcache_handle_get_content(h); + + assert(c != NULL); + assert(c->type == CONTENT_HTML); + + return c->data.html.encoding_source; +} + /** * Retrieve framesets used in an HTML document * diff --git a/render/html.h b/render/html.h index 79a3b209a..8977e6dd6 100644 --- a/render/html.h +++ b/render/html.h @@ -224,6 +224,7 @@ bool text_redraw(const char *utf8_text, size_t utf8_len, xmlDoc *html_get_document(struct hlcache_handle *h); struct box *html_get_box_tree(struct hlcache_handle *h); const char *html_get_encoding(struct hlcache_handle *h); +binding_encoding_source html_get_encoding_source(struct hlcache_handle *h); struct content_html_frames *html_get_frameset(struct hlcache_handle *h); struct content_html_iframe *html_get_iframe(struct hlcache_handle *h); const char *html_get_base_url(struct hlcache_handle *h); -- cgit v1.2.3