Browse Source

BUG: Parse more bzr xml output encodings

The BZR xml output plugin can use some encodings that are not recognized
by expat, which leads to "Error parsing bzr log xml: unknown encoding".
This works around the problem by giving expat a mapping, and adds a
test.  Patch from Tom Vercauteren.  See issue #6857.
Brad King 16 years ago
parent
commit
55c4cbbae9
2 changed files with 10 additions and 1 deletions
  1. 6 1
      Source/CTest/cmCTestBZR.cxx
  2. 4 0
      Tests/CMakeLists.txt

+ 6 - 1
Source/CTest/cmCTestBZR.cxx

@@ -67,7 +67,12 @@ int cmBZRXMLParserUnknownEncodingHandler(void*,
       0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x00FD, 0x00FE, 0x00FF
     };
 
-  if ( name==std::string("ascii") || name==std::string("cp1252") )
+  // The BZR xml output plugin can use some encodings that are not
+  // recognized by expat.  This will lead to an error, e.g. "Error
+  // parsing bzr log xml: unknown encoding", the following is a
+  // workaround for these unknown encodings.
+  if(name == std::string("ascii") || name == std::string("cp1252") ||
+     name == std::string("ANSI_X3.4-1968"))
     {
     for(unsigned int i=0;i<256;++i) info->map[i] = latin1[i];
     return 1;

+ 4 - 0
Tests/CMakeLists.txt

@@ -939,6 +939,10 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=CVS -P ${CMake_SOURCE_DIR}/Utilities/Rel
         ADD_TEST(CTest.UpdateBZR ${CMAKE_CMAKE_COMMAND}
           -P "${CMake_BINARY_DIR}/Tests/CTestUpdateBZR.cmake"
           )
+        ADD_TEST(CTest.UpdateBZR.CLocale ${CMAKE_CMAKE_COMMAND}
+          -P "${CMake_BINARY_DIR}/Tests/CTestUpdateBZR.cmake"
+          )
+        SET_TESTS_PROPERTIES(CTest.UpdateBZR.CLocale PROPERTIES ENVIRONMENT LC_ALL=C)
         LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/${CTestUpdateBZR_DIR}")
       ENDIF( NOT ${xmlplugres} )
     ENDIF(BZR_EXECUTABLE)