Code Tidy - Pastebin

New     Fork     Embed     View raw     View parent     Report
Escribir Fichero UTF8 fork - java

Embed

You can embed this paste into a blog or website with this code:

<iframe class="codetidy" type="text/html" width="100%" src="http://codetidy.com/paste/embed/1380" frameborder="0"></iframe>

Add comment

Captcha
  1. package com.lineadecodigo.java.file.encoding;?
  2.  ?
  3. /**?
  4.  * @file EscribirFicheroUTF8.java?
  5.  * @version 1.0?
  6.  * @author Linea de Codigo (http://lineadecodigo.com)?
  7.  * @date   30/noviembre/2011?
  8.  * @url    http://lineadecodigo.com/java/escribir-un-fichero-utf-8/?
  9.  * @description Programa que escribe un fichero con encoding UTF-8?
  10.  */?
  11.  ?
  12. import java.io.BufferedWriter;?
  13. import java.io.FileOutputStream;?
  14. import java.io.IOException;?
  15. import java.io.OutputStreamWriter;?
  16. import java.io.UnsupportedEncodingException;?
  17.  ?
  18. public class EscribirFicheroUTF8 {?
  19.  ?
  20.         public static void main(String[] args) {?
  21.  ?
  22.                 try {?
  23.                         BufferedWriter out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream("FicheroSalidaUTF8.txt"), "utf-8"));?
  24.                         out.write("Esto es un fichero UTF8");?
  25.                         out.close();?
  26.                 } catch (UnsupportedEncodingException e) {?
  27.                         e.printStackTrace();?
  28.                 } catch (IOException e) {?
  29.                         e.printStackTrace();?
  30.                 }?
  31.  ?
  32.  ?
  33.         }?
  34.  ?
  35. }?
© 2011 Code Tidy  Terms and conditions