mirror of
https://github.com/rkd77/elinks.git
synced 2024-12-04 14:46:47 -05:00
add_html_to_string: Do not encode bytes 0x80...0xFF.
Reported by Witold Filipczyk.
This commit is contained in:
parent
44adb76799
commit
aa79ecfe72
@ -275,7 +275,7 @@ struct string *
|
|||||||
add_html_to_string(struct string *string, const unsigned char *src, int len)
|
add_html_to_string(struct string *string, const unsigned char *src, int len)
|
||||||
{
|
{
|
||||||
for (; len; len--, src++) {
|
for (; len; len--, src++) {
|
||||||
if (*src < 0x20 || *src >= 0x7F
|
if (*src < 0x20
|
||||||
|| *src == '<' || *src == '>' || *src == '&'
|
|| *src == '<' || *src == '>' || *src == '&'
|
||||||
|| *src == '\"' || *src == '\'') {
|
|| *src == '\"' || *src == '\'') {
|
||||||
int rollback_length = string->length;
|
int rollback_length = string->length;
|
||||||
|
@ -76,7 +76,12 @@ add_string_replace(struct string *string, unsigned char *src, int len,
|
|||||||
#define add_real_optname_to_string(str, src, len) \
|
#define add_real_optname_to_string(str, src, len) \
|
||||||
add_string_replace(str, src, len, '*', '.')
|
add_string_replace(str, src, len, '*', '.')
|
||||||
|
|
||||||
/* Convert reserved chars to html &#xx */
|
/* Convert reserved chars to html &#xx;. This function copies bytes
|
||||||
|
* 0x80...0xFF unchanged, so the caller should ensure that the
|
||||||
|
* resulting HTML will be parsed with the same charset as the original
|
||||||
|
* string. (This function cannot use the   syntax for non-ASCII,
|
||||||
|
* because HTML wants Unicode numbers there and this function does not
|
||||||
|
* know the charset of the input data.) */
|
||||||
struct string *add_html_to_string(struct string *string, const unsigned char *html, int htmllen);
|
struct string *add_html_to_string(struct string *string, const unsigned char *html, int htmllen);
|
||||||
|
|
||||||
/* Escapes \ and " with a \ */
|
/* Escapes \ and " with a \ */
|
||||||
|
Loading…
Reference in New Issue
Block a user