Fórum Converter String para UTF-8 #568075
09/04/2009
0
Jon
Curtir tópico
+ 0Posts
09/04/2009
Marcelo Guimarães
public static ByteBuffer toByteBuffer(String content, String encode) {
Charset charset = Charset.forName(encode);
ByteBuffer bb = charset.encode(content);
return bb;
}Gostei + 0
09/04/2009
Jon
Gostei + 0
09/04/2009
Jon
Gostei + 0
09/04/2009
Marcelo Guimarães
Gostei + 0
09/04/2009
Marcelo Guimarães
Gostei + 0
09/04/2009
Carlos Heuberger
String string = ...
byte[] bytes = string.getBytes("UTF-8"); String string = "teste já";
try {
byte[] bytes = string.getBytes("UTF-8");
FileOutputStream out = new FileOutputStream("teste.txt");
out.write(bytes);
out.close();
} catch (Exception ex) {
ex.printStackTrace();
}Gostei + 0
Clique aqui para fazer login e interagir na Comunidade :)