From ca12878c2f0c1617a1b86a0c54b3a94b88c1caa6 Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Mon, 12 Sep 2016 22:43:39 +0100 Subject: use ascii processing when determining form charset --- render/form.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'render') diff --git a/render/form.c b/render/form.c index 8ae59b5ed..52e54e477 100644 --- a/render/form.c +++ b/render/form.c @@ -26,7 +26,6 @@ */ #include -#include #include #include #include @@ -40,6 +39,7 @@ #include "utils/url.h" #include "utils/utf8.h" #include "utils/utils.h" +#include "utils/ascii.h" #include "content/fetch.h" #include "content/hlcache.h" #include "css/utils.h" @@ -980,8 +980,9 @@ char *form_acceptable_charset(struct form *form) return NULL; /* make it upper case */ - for (c = temp; *c; c++) - *c = toupper(*c); + for (c = temp; *c; c++) { + *c = ascii_to_upper(*c); + } /* is UTF-8 specified? */ c = strstr(temp, "UTF-8"); @@ -997,14 +998,14 @@ char *form_acceptable_charset(struct form *form) * form element contains a space and/or comma separated list */ c = form->accept_charsets; - /* What would be an improvement would be to choose an encoding + /** \todo an improvement would be to choose an encoding * acceptable to the server which covers as much of the input - * values as possible. Additionally, we need to handle the case - * where none of the acceptable encodings cover all the textual - * input values. - * For now, we just extract the first element of the charset list + * values as possible. Additionally, we need to handle the + * case where none of the acceptable encodings cover all the + * textual input values. For now, we just extract the first + * element of the charset list */ - while (*c && !isspace(*c)) { + while (*c && !ascii_is_space(*c)) { if (*c == ',') break; c++; -- cgit v1.2.3