Java UTF8 convertISO8859_1_to_UTF_8(String s)

Here you can find the source of convertISO8859_1_to_UTF_8(String s)

Description

convert IStUT_

License

Open Source License

Declaration

public static String convertISO8859_1_to_UTF_8(String s) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 *     Cloud Foundry/*from w  w w . jav a 2 s  . com*/
 *     Copyright (c) [2009-2016] Pivotal Software, Inc. All Rights Reserved.
 *
 *     This product is licensed to you under the Apache License, Version 2.0 (the "License").
 *     You may not use this product except in compliance with the License.
 *
 *     This product includes a number of subcomponents with
 *     separate copyright notices and license terms. Your use of these
 *     subcomponents is subject to the terms and conditions of the
 *     subcomponent's license, as noted in the LICENSE file.
 *******************************************************************************/

import java.nio.charset.Charset;

public class Main {
    public static final String ISO_8859_1 = "ISO-8859-1";
    public static final String UTF_8 = "UTF-8";

    public static String convertISO8859_1_to_UTF_8(String s) {
        if (s == null) {
            return null;
        } else {
            return new String(s.getBytes(Charset.forName(ISO_8859_1)),
                    Charset.forName(UTF_8));
        }
    }
}

Related

  1. backup(String inputFile, String backupFile)
  2. codeListToString(List utf8CodeList)
  3. codesToString(int[] utf8Codes)
  4. codeToString(int utf8Code)
  5. compareWithGold(String goldfile, String outputfile)
  6. ConvertUTF8(byte[] buffer)
  7. createFileAndExport(String inputFileName, String outputFileName, String outputStr)
  8. createFromUTF8String(DatagramPacket packet, String str)
  9. createTemporaryOutputFolder()