docs: private String escapeForPOFile(final String input, boolean fix) {
          if (input == null) return "";
  
          String escapedString = input;
  
          // Publican escapes greater/lesser than to XML entities
          if (fix && (input.contains(" < ") || input.contains(" > "))) {
              // Loop over and find all the XML Elements as they should remain untouched.
              final LinkedList<String> elements = new LinkedList<String>();
              if (input.indexOf('<') != -1) {
                  int index = -1;
                  while ((index = input.indexOf('<', index + 1)) != -1) {
                      int endIndex = input.indexOf('>', index);
                      int nextIndex = input.indexOf('<', index + 1);
  
                      /*
                        * If the next opening tag is less than the next ending tag, than the current opening tag isn't a match for the next
                        * ending tag, so continue to the next one
                        */
                      if (endIndex == -1 || (nextIndex != -1 && nextIndex < endIndex)) {
                          continue;
                      } else if (index + 1 == endIndex) {
                          // This is a <> sequence, so it should be ignored as well.
                          continue;
                      } else {
                          elements.add(input.substring(index, endIndex + 1));
                      }
  
                  }
              }
  
              // Find all the elements and replace them with a marker
              for (int count = 0; count < elements.size(); count++) {
                  escapedString = escapedString.replace(elements.get(count), "###" + count + "###");
              }
  
              // Perform the replacements on what's left
              escapedString = escapedString.replace("<", "&lt;").replace(">", "&gt;");
  
              // Replace the markers
              for (int count = 0; count < elements.size(); count++) {
                  escapedString = escapedString.replace("###" + count + "###", elements.get(count));
              }
          }
  
          return escapedString.replace("\\", "\\\\")
                  .replace("\"", "\\\"")
                  .replace("\n", "\\n")
                  .replace("\r", "\\r");
      }