]> granicus.if.org Git - icu/commitdiff
ICU-12766 fix issue w/ u8 escaping
authorSteven R. Loomis <srl@icu-project.org>
Thu, 16 Mar 2017 15:15:26 +0000 (15:15 +0000)
committerSteven R. Loomis <srl@icu-project.org>
Thu, 16 Mar 2017 15:15:26 +0000 (15:15 +0000)
* greek tests now pass on solaris

X-SVN-Rev: 39835

icu4c/source/tools/escapesrc/escapesrc.cpp
icu4c/source/tools/escapesrc/expect-simple.cpp

index 68845d51a6de17538fe279f1adb93cd1fe509868..e28c5808cf96d3f957e3a9387168754787c6c0a2 100644 (file)
 #include "unicode/utf8.h"
 
 static const char
-  kSPACE = 0x20,
-  kTAB   = 0x09,
-  kLF    = 0x0A,
-  kCR    = 0x0D,
-  kHASH  = 0x23,
-  kSLASH = 0x2f,
-  kSTAR  = 0x2A,
-  kL_U   = 0x75,
-  kU_U   = 0x55,
-  kQUOT  = 0x27,
-  kDBLQ  = 0x22;
+  kSPACE   = 0x20,
+  kTAB     = 0x09,
+  kLF      = 0x0A,
+  kCR      = 0x0D,
+  // kHASH    = 0x23,
+  // kSLASH   = 0x2f,
+  kBKSLASH = 0x5C,
+  // kSTAR    = 0x2A,
+  kL_U     = 0x75,
+  kU_U     = 0x55,
+  kQUOT    = 0x27,
+  kDBLQ    = 0x22;
 
 std::string prog;
 
@@ -52,17 +53,15 @@ int cleanup(const std::string &outfile) {
   return 0;
 }
 
-#if 0
-inline bool hasNonAscii(const char *line, size_t len) {
-  const unsigned char *uline = reinterpret_cast<const unsigned char*>(line);
-  for(size_t i=0;i<len; i++) {
-    if( uline[i] > 0x7F) {
-      return true;
-    }
-  }
-  return false;
-}
-#endif
+// inline bool hasNonAscii(const char *line, size_t len) {
+//   const unsigned char *uline = reinterpret_cast<const unsigned char*>(line);
+//   for(size_t i=0;i<len; i++) {
+//     if( uline[i] > 0x7F) {
+//       return true;
+//     }
+//   }
+//   return false;
+// }
 
 inline const char *skipws(const char *p, const char *e) {
   for(;p<e;p++) {
@@ -79,31 +78,29 @@ inline const char *skipws(const char *p, const char *e) {
   return p;
 }
 
-#if 0
-inline bool isCommentOrEmpty(const char* line, size_t len) {
-  const char *p = line;
-  const char *e = line+len;
-  p = skipws(p,e);
-  if(p==e) {
-    return true; // whitespace only
-  }
-  p++;
-  switch(*p) {
-  case kHASH: return true; // #directive
-  case kSLASH:
-    p++;
-    if(p==e) return false; // single slash
-    switch(*p) {
-    case kSLASH: // '/ /'
-    case kSTAR: // '/ *'
-      return true; // start of comment
-    default: return false; // something else
-    }
-  default: return false; // something else
-  }
-  /*NOTREACHED*/
-}
-#endif
+// inline bool isCommentOrEmpty(const char* line, size_t len) {
+//   const char *p = line;
+//   const char *e = line+len;
+//   p = skipws(p,e);
+//   if(p==e) {
+//     return true; // whitespace only
+//   }
+//   p++;
+//   switch(*p) {
+//   case kHASH: return true; // #directive
+//   case kSLASH:
+//     p++;
+//     if(p==e) return false; // single slash
+//     switch(*p) {
+//     case kSLASH: // '/ /'
+//     case kSTAR: // '/ *'
+//       return true; // start of comment
+//     default: return false; // something else
+//     }
+//   default: return false; // something else
+//   }
+//   /*NOTREACHED*/
+// }
 
 void appendByte(std::string &outstr,
                 uint8_t byte) {
@@ -156,7 +153,7 @@ bool fixu8(std::string &linestr, size_t origpos, size_t &endpos) {
   outstr += (kDBLQ);
   for(;pos<endpos;pos++) {
     char c = linestr[pos];
-    if(c == kSLASH) {
+    if(c == kBKSLASH) {
       char c2 = linestr[++pos];
       switch(c2) {
       case kQUOT:
index 20d2bd8144137506fe1cc8cff7f66bde2cdfad31..3770bfba7ec1a81dd75418790965128f30787d7d 100644 (file)
@@ -8,9 +8,9 @@ u"\U000219F2";
  u"sa\u0127\u0127a";
  u'\u6587'; u"\U000219F2";
 
-"\x20\x5C\x75\x30\x33\x30\x31";
-"\x5C\x75\x30\x33\x30\x38\x20";
-"\x73\x61\x5C\x75\x30\x31\x32\x37\x5C\x75\x30\x31\x32\x37\x61";
-"\x5C\x75\x36\x35\x38\x37";
-"\x5C\x55\x30\x30\x30\x32\x31\x39\x46\x32";
-"\x73\x61\x5C\x75\x30\x31\x32\x37\x5C\x75\x30\x31\x32\x37\x61";
+"\x20\xCC\x81";
+"\xCC\x88\x20";
+"\x73\x61\xC4\xA7\xC4\xA7\x61";
+"\xE6\x96\x87";
+"\xF0\xA1\xA7\xB2";
+"\x73\x61\xC4\xA7\xC4\xA7\x61";