mirror of
				https://gitlab.gnome.org/GNOME/libxml2.git
				synced 2025-10-30 10:45:36 +03:00 
			
		
		
		
	entities: Don't change doc when encoding entities
doc->encoding shouldn't be touched by xmlEncodeEntitiesInternal.
This commit is contained in:
		| @@ -718,8 +718,6 @@ xmlEncodeEntitiesInternal(xmlDocPtr doc, const xmlChar *input, int attr) { | |||||||
| 		    (((cur[0] & 0xF8) == 0xF8))) { | 		    (((cur[0] & 0xF8) == 0xF8))) { | ||||||
| 		    xmlEntitiesErr(XML_CHECK_NOT_UTF8, | 		    xmlEntitiesErr(XML_CHECK_NOT_UTF8, | ||||||
| 			    "xmlEncodeEntities: input not UTF-8"); | 			    "xmlEncodeEntities: input not UTF-8"); | ||||||
| 		    if (doc != NULL) |  | ||||||
| 			doc->encoding = xmlStrdup(BAD_CAST "ISO-8859-1"); |  | ||||||
| 		    snprintf(buf, sizeof(buf), "&#%d;", *cur); | 		    snprintf(buf, sizeof(buf), "&#%d;", *cur); | ||||||
| 		    buf[sizeof(buf) - 1] = 0; | 		    buf[sizeof(buf) - 1] = 0; | ||||||
| 		    ptr = buf; | 		    ptr = buf; | ||||||
| @@ -751,8 +749,6 @@ xmlEncodeEntitiesInternal(xmlDocPtr doc, const xmlChar *input, int attr) { | |||||||
| 		if ((l == 1) || (!IS_CHAR(val))) { | 		if ((l == 1) || (!IS_CHAR(val))) { | ||||||
| 		    xmlEntitiesErr(XML_ERR_INVALID_CHAR, | 		    xmlEntitiesErr(XML_ERR_INVALID_CHAR, | ||||||
| 			"xmlEncodeEntities: char out of range\n"); | 			"xmlEncodeEntities: char out of range\n"); | ||||||
| 		    if (doc != NULL) |  | ||||||
| 			doc->encoding = xmlStrdup(BAD_CAST "ISO-8859-1"); |  | ||||||
| 		    snprintf(buf, sizeof(buf), "&#%d;", *cur); | 		    snprintf(buf, sizeof(buf), "&#%d;", *cur); | ||||||
| 		    buf[sizeof(buf) - 1] = 0; | 		    buf[sizeof(buf) - 1] = 0; | ||||||
| 		    ptr = buf; | 		    ptr = buf; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user