Java UTF8 File Read readAsUTF8(String text)

Here you can find the source of readAsUTF8(String text)

Description

read As UTF

License

BSD License

Declaration

public static String readAsUTF8(String text) 

Method Source Code


//package com.java2s;
//License from project: BSD License 

import java.nio.charset.Charset;

public class Main {
    private final static Charset ENC_LATIN1 = Charset.forName("ISO-8859-1");
    private final static Charset ENC_UTF8 = Charset.forName("UTF-8");

    public static String readAsUTF8(String text) {
        if (text == null)
            return null;
        return new String(text.getBytes(ENC_LATIN1), ENC_UTF8);
    }//  ww w.  j a  v  a 2 s  .co m
}

Related

  1. loadUTF8(File file)
  2. makeUTF8Reader(InputStream inputStream)
  3. newUtf8Reader(final InputStream in)
  4. openFileReaderUTF8(File file)
  5. readAllLines(File inputFile)
  6. readLines(File inputFile)
  7. readRawUTF8Bytes(final byte[] bytes)
  8. readResourceUtf8(Class contextClass, String filename)
  9. readStringFromUTF8Stream(InputStream is)