Convert Shift_JIS format to UTF-8 format

前端 未结 3 977
粉色の甜心
粉色の甜心 2021-01-07 15:01

I am trying to convert a Shift_JIS formatted file into UTF-8 format. For this, below is my approach:

  1. Read Shift_JIS file
  2. getBytes of each line and con
3条回答
  •  北海茫月
    2021-01-07 15:36

    Finally i found the solution. Was doing some very basic mistake. Below code is working perfectly fine:

    InputStream inputStream = getContentResolver().openInputStream(uri);
    BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream, "Shift_JIS"));
    byte[] b = line.getBytes();
    String value = new String(b, "UTF-8");
    

提交回复
热议问题