src/main/java/org/jboss/util/xml/catalog/Catalog.java
protected String normalizeURI(String uriref) {
    String newRef = "";
    byte[] bytes;

    if (uriref == null) {
      return null;
    }

    try {
      bytes = uriref.getBytes("UTF-8");
    } catch (UnsupportedEncodingException uee) {
      // this can't happen
      catalogManager.debug.message(1, "UTF-8 is an unsupported encoding!?");
      return uriref;
    }

    for (int count = 0; count < bytes.length; count++) {
      int ch = bytes[count] & 0xFF;

      if ((ch <= 0x20)    // ctrl
	  || (ch > 0x7F)  // high ascii
	  || (ch == 0x22) // "
	  || (ch == 0x3C) // <
	  || (ch == 0x3E) // >
	  || (ch == 0x5C) // \
	  || (ch == 0x5E) // ^
	  || (ch == 0x60) // `
	  || (ch == 0x7B) // {
	  || (ch == 0x7C) // |
	  || (ch == 0x7D) // }
	  || (ch == 0x7F)) {
	newRef += encodedByte(ch);
      } else {
	newRef += (char) bytes[count];
      }
    }

    return newRef;
  }
protected String normalizeURI(String uriref) {
    String newRef = "";
    byte[] bytes;

    if (uriref == null) {
      return null;
    }

    try {
      bytes = uriref.getBytes("UTF-8");
    } catch (UnsupportedEncodingException uee) {
      // this can't happen
      catalogManager.debug.message(1, "UTF-8 is an unsupported encoding!?");
      return uriref;
    }

    for (int count = 0; count < bytes.length; count++) {
      int ch = bytes[count] & 0xFF;

      if ((ch <= 0x20)    // ctrl
	  || (ch > 0x7F)  // high ascii
	  || (ch == 0x22) // "
	  || (ch == 0x3C) // <
	  || (ch == 0x3E) // >
	  || (ch == 0x5C) // \
	  || (ch == 0x5E) // ^
	  || (ch == 0x60) // `
	  || (ch == 0x7B) // {
	  || (ch == 0x7C) // |
	  || (ch == 0x7D) // }
	  || (ch == 0x7F)) {
	newRef += encodedByte(ch);
      } else {
	newRef += (char) bytes[count];
      }
    }

    return newRef;
  }
Perform character normalization on a URI reference.

@param uriref The URI reference
@return The normalized URI reference.