Java UTF from toUTF8(String string)

Here you can find the source of toUTF8(String string)

Description

Encodes a String to UTF-8.

License

Open Source License

Declaration

public static byte[] toUTF8(String string) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.nio.charset.Charset;

public class Main {
    public static final Charset UTF_8 = Charset.forName("UTF-8");

    /**/*  w  w  w.  ja va2s .c o m*/
     * Encodes a String to UTF-8.
     */
    public static byte[] toUTF8(String string) {
        return string.getBytes(UTF_8);
    }
}

Related

  1. toUTF8(String oldStr)
  2. toUtf8(String s)
  3. toUTF8(String s)
  4. toUTF8(String s, String encoding)
  5. toUTF8(String str)
  6. toUtf8(String texto)
  7. toUTF8ByteArray(String s)
  8. toUtf8ByteArray(String source)
  9. toUtf8Code(char utf16)