code: public static String escapeDestName(String destName) {
      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "escapeDestName", destName);
  
      if(destName != null) {
        // check for unescaped '\' chars
        int nextIndex = 0;
        while((nextIndex = destName.indexOf('\\', nextIndex)) != -1) {
          char nextChar = (char)-1;
          if ((nextIndex+1)<destName.length()) nextChar = destName.charAt(nextIndex + 1);
          if(nextChar != CHAR_BACKSLASH) {
            // add in an escape char
            destName = destName.substring(0, nextIndex) + STRING_BACKSLASH + destName.substring(nextIndex);
          }
          nextIndex += 2; // need to move on by two
        }
  
        // check for unescaped '?' chars
        nextIndex = 0;
        while((nextIndex = destName.indexOf('?', nextIndex)) != -1) {
          if(!charIsEscaped(destName, nextIndex)) {
            // add in an escape char
            destName = destName.substring(0, nextIndex) + STRING_BACKSLASH + destName.substring(nextIndex);
          }
          nextIndex++;
        }
      }
  
      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "escapeDestName",  destName);
      return destName;
    }
docs: This method is used by encodeMap() to escape ?s and \s in the dest name.
  
  NB This method will fail if called multiple times on the same string,
  e.g. foo?bar -> foo\?bar -> foo\\\?bar etc.