[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[xml] path to add KOI8-R encoding



Hello!

    Could you apply this little patch to add russian KOI8-R encoding
    handler for libxml2-2.4.12?

Thank you!

-- 
dapi
diff -urp libxml2-2.4.12/encoding.c libxml2-2.4.12ru/encoding.c
--- libxml2-2.4.12/encoding.c	Sun Nov  4 23:23:38 2001
+++ libxml2-2.4.12ru/encoding.c	Sat Dec 22 01:45:10 2001
@@ -1377,6 +1377,7 @@ xmlParseCharEncoding(const char* name)
     if (!strcmp(upper, "ISO-2022-JP")) return(XML_CHAR_ENCODING_2022_JP);
     if (!strcmp(upper, "SHIFT_JIS")) return(XML_CHAR_ENCODING_SHIFT_JIS);
     if (!strcmp(upper, "EUC-JP")) return(XML_CHAR_ENCODING_EUC_JP);
+    if (!strcmp(upper, "KOI8-R")) return(XML_CHAR_ENCODING_KOI8_R);
 
 #ifdef DEBUG_ENCODING
     xmlGenericError(xmlGenericErrorContext, "Unknown encoding %s\n", name);
@@ -1446,6 +1447,8 @@ xmlGetCharEncodingName(xmlCharEncoding e
             return("EUC-JP");
 	case XML_CHAR_ENCODING_ASCII:
 	    return(NULL);
+        case XML_CHAR_ENCODING_KOI8_R:
+	    return("KOI8-R");
     }
     return(NULL);
 }
@@ -1738,6 +1741,10 @@ xmlGetCharEncodingHandler(xmlCharEncodin
 	    handler = xmlFindCharEncodingHandler("ISO-8859-9");
 	    if (handler != NULL) return(handler);
 	    break;
+        case XML_CHAR_ENCODING_KOI8_R:
+            handler = xmlFindCharEncodingHandler("KOI8-R");
+            if (handler != NULL) return(handler);
+            break;
 
 
         case XML_CHAR_ENCODING_2022_JP:
diff -urp libxml2-2.4.12/include/libxml/encoding.h libxml2-2.4.12ru/include/libxml/encoding.h
--- libxml2-2.4.12/include/libxml/encoding.h	Wed Oct 10 13:45:48 2001
+++ libxml2-2.4.12ru/include/libxml/encoding.h	Sat Dec 22 01:45:11 2001
@@ -77,7 +77,8 @@ typedef enum {
     XML_CHAR_ENCODING_2022_JP=  19,/* ISO-2022-JP */
     XML_CHAR_ENCODING_SHIFT_JIS=20,/* Shift_JIS */
     XML_CHAR_ENCODING_EUC_JP=   21,/* EUC-JP */
-    XML_CHAR_ENCODING_ASCII=    22 /* pure ASCII */
+    XML_CHAR_ENCODING_ASCII=    22,/* pure ASCII */
+    XML_CHAR_ENCODING_KOI8_R=   23 /* KOI8-R */
 } xmlCharEncoding;
 
 /**
diff -urp libxml2-2.4.12/parserInternals.c libxml2-2.4.12ru/parserInternals.c
--- libxml2-2.4.12/parserInternals.c	Thu Nov 22 06:35:05 2001
+++ libxml2-2.4.12ru/parserInternals.c	Sat Dec 22 01:45:11 2001
@@ -1667,6 +1667,7 @@ xmlSwitchEncoding(xmlParserCtxtPtr ctxt,
 	    case XML_CHAR_ENCODING_8859_7:
 	    case XML_CHAR_ENCODING_8859_8:
 	    case XML_CHAR_ENCODING_8859_9:
+	    case XML_CHAR_ENCODING_KOI8_R:
 		/*
 		 * We used to keep the internal content in the
 		 * document encoding however this turns being unmaintainable


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]