code: private void mapText(String oldText, Map<String, String> replacements)
     {
        char c2 = 0;
        if (oldText != null && oldText.length() != 0 && !replacements.containsKey(oldText))
        {
           StringBuilder newText = new StringBuilder(oldText.length());
           for (int loop = 0; loop < oldText.length(); loop++)
           {
              char c = oldText.charAt(loop);
              if (Character.isUpperCase(c))
              {
                 newText.append('X');
              }
              else
              {
                 if (Character.isLowerCase(c))
                 {
                    newText.append('x');
                 }
                 else
                 {
                    if (Character.isDigit(c))
                    {
                       newText.append('0');
                    }
                    else
                    {
                       if (Character.isLetter(c))
                       {
                          // Handle other codepages etc. If possible find a way to
                          // maintain the same code page as original.
                          // E.g. replace with a character from the same alphabet.
                          // This 'should' work for most cases
                          if (c2 == 0)
                          {
                             c2 = c;
                          }
                          newText.append(c2);
                       }
                       else
                       {
                          newText.append(c);
                       }
                    }
                 }
              }
           }
  
           replacements.put(oldText, newText.toString());
        }
     }
docs: Converts plan text into anonymous text. Preserves upper case, lower case,
  punctuation, whitespace and digits while making the text unreadable.
  
  @param oldText text to replace
  @param replacements map of find/replace pairs