(file) Return to XmlReader.cpp CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Pegasus / Common

Diff for /pegasus/src/Pegasus/Common/XmlReader.cpp between version 1.87 and 1.88

version 1.87, 2003/08/22 14:54:39 version 1.88, 2003/08/25 15:15:02
Line 916 
Line 916 
 } }
  
 // See http://www.ietf.org/rfc/rfc2396.txt section 2 // See http://www.ietf.org/rfc/rfc2396.txt section 2
   //
   // Also see the "CIM Operations over HTTP" spec, section 3.3.2 and
   // 3.3.3, for the treatment of non US-ASCII chars (UTF-8)
 String XmlReader::decodeURICharacters(String uriString) String XmlReader::decodeURICharacters(String uriString)
 { {
     String decodedString;  
     Uint32 i;     Uint32 i;
  
       Array<Uint8> utf8Chars;
   
     for (i=0; i<uriString.size(); i++)     for (i=0; i<uriString.size(); i++)
     {     {
         if (uriString[i] == '%')         if (uriString[i] == '%')
Line 952 
Line 956 
               throw ParseError(MessageLoader::getMessage(mlParms));               throw ParseError(MessageLoader::getMessage(mlParms));
             }             }
  
             // ATTN: Handle non-UTF-8 character sets  
             Uint16 decodedChar = Uint16(digit1<<4) + Uint16(digit2);             Uint16 decodedChar = Uint16(digit1<<4) + Uint16(digit2);
             decodedString.append(Char16(decodedChar));              utf8Chars.append((Uint8)decodedChar);
         }         }
         else         else
         {         {
             decodedString.append(uriString[i]);              utf8Chars.append((Uint8)uriString[i]);
         }         }
     }     }
  
     return decodedString;      // If there was a string to decode...
       if (uriString.size() > 0)
       {
           // Convert UTF-8 to UTF-16 and return the String
           utf8Chars.append('\0');
           return String((char *)utf8Chars.getData(),STRING_FLAG_UTF8);
       }
       else
       {
           return String();
       }
 } }
  
 //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
Line 1237 
Line 1250 
  
         case CIMTYPE_CHAR16:         case CIMTYPE_CHAR16:
         {         {
   
   // remove this test, utf-8 can be up to 6 bytes per char
   /*
           if (strlen(valueString) != 1) {           if (strlen(valueString) != 1) {
               // l10n
  
               // throw XmlSemanticError(lineNumber, "Invalid char16 value");
   
               MessageLoaderParms mlParms("Common.XmlReader.INVALID_CHAR16_VALUE",
                                          "Invalid char16 value");
   
               throw XmlSemanticError(lineNumber, mlParms);
             }
   */
             // Converts UTF-8 to UTF-16
             String tmp(valueString, STRING_FLAG_UTF8);
             if (tmp.size() != 1)
             {
             // l10n             // l10n
  
             // throw XmlSemanticError(lineNumber, "Invalid char16 value");             // throw XmlSemanticError(lineNumber, "Invalid char16 value");
Line 1249 
Line 1278 
             throw XmlSemanticError(lineNumber, mlParms);             throw XmlSemanticError(lineNumber, mlParms);
           }           }
  
             return CIMValue(Char16(valueString[0]));              return CIMValue(tmp[0]);
         }         }
  
         case CIMTYPE_UINT8:         case CIMTYPE_UINT8:


Legend:
Removed from v.1.87  
changed lines
  Added in v.1.88

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2