Search notes:

Java class java.lang.String - getBytes

public class getBytes {


  private static void printHex(byte[] bytes) {

    for (byte b: bytes) {
      System.out.printf("%02x ", b);
    }
    System.out.println();

  }


  public static void main(String[] argv) {

    String text = new String("René");

    try {
      printHex(text.getBytes(            ));
      printHex(text.getBytes("ISO-8859-1"));
      printHex(text.getBytes("UTF-8"     ));
      printHex(text.getBytes("UTF-16"    ));
      printHex(text.getBytes("UTF-32"    ));
      printHex(text.getBytes("GB18030"   ));
      printHex(text.getBytes("EBCDIC"    ));
    }
    catch (java.io.UnsupportedEncodingException e) {
      System.out.println(e.toString());
    }
  }

}
Github repository JavaClasses, path: /java/lang/String/getBytes.java

See also

Java classes
Unicode, character set

Index

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/developm...', 1737543003, '18.223.211.43', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/development/languages/Java/classes/java/lang/String/getBytes(72): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78