Reading UTF-8 Encoded Data - Java Internationalization

Java examples for Internationalization:Unicode

Description

Reading UTF-8 Encoded Data

Demo Code

import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;

public class Main {

  public void m() {
    try {//from  w  w w  .ja  v a2 s.  co m
      BufferedReader in = new BufferedReader(new InputStreamReader(
          new FileInputStream("infilename"), "UTF8"));
      String str = in.readLine();
    } catch (UnsupportedEncodingException e) {
    } catch (IOException e) {
    }
  }
}

Related Tutorials