code: public static boolean isPrintableStringChar(char ch) {
          if ((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') ||
              (ch >= '0' && ch <= '9')) {
              return true;
          } else {
              switch (ch) {
                  case ' ':       /* space */
                  case '\'':      /* apostrophe */
                  case '(':       /* left paren */
                  case ')':       /* right paren */
                  case '+':       /* plus */
                  case ',':       /* comma */
                  case '-':       /* hyphen */
                  case '.':       /* period */
                  case '/':       /* slash */
                  case ':':       /* colon */
                  case '=':       /* equals */
                  case '?':       /* question mark */
                      return true;
                  default:
                      return false;
              }
          }
      }
docs: Determine if a character is one of the permissible characters for
  PrintableString:
  A-Z, a-z, 0-9, space, apostrophe (39), left and right parentheses,
  plus sign, comma, hyphen, period, slash, colon, equals sign,
  and question mark.
  
  Characters that are *not* allowed in PrintableString include
  exclamation point, quotation mark, number sign, dollar sign,
  percent sign, ampersand, asterisk, semicolon, less than sign,
  greater than sign, at sign, left and right square brackets,
  backslash, circumflex (94), underscore, back quote (96),
  left and right curly brackets, vertical line, tilde,
  and the control codes (0-31 and 127).
  
  This list is based on X.680 (the ASN.1 spec).