Skip to content
This repository has been archived by the owner on Jul 11, 2018. It is now read-only.

tb_tddl code采用的是什么编码,注释全部乱码 #9

Open
chengcheng222e opened this issue May 26, 2016 · 3 comments
Open

tb_tddl code采用的是什么编码,注释全部乱码 #9

chengcheng222e opened this issue May 26, 2016 · 3 comments

Comments

@chengcheng222e
Copy link

我在用Intellij IDEA打开源码的时候,发现注释基本上都是乱码的,感觉不是太友好。

@carl-zeiss
Copy link

gbk

@iqiancheng
Copy link

iqiancheng commented Nov 10, 2016

或许你需要这个 :)

import org.apache.commons.io.FileUtils;


import java.io.File;
import java.io.IOException;
import java.util.Collection;

/**
 * Created with IntelliJ IDEA.
 * @author : <a herf="mailto:[email protected]">qian.cheng</a>
 * To change encoding GBK to UTF-8.
 */
public class GBK2UTF8 {

    public static void main(String[] args) throws IOException {

        //GBK编码格式源码路径
        String srcDirPath = "D:\\Coding\\code\\tddl";
        //转为UTF-8编码格式源码路径
        String utf8DirPath = "D:\\Coding\\code\\tddl2";

        //获取所有java文件
        Collection<File> javaGbkFileCol =  FileUtils.listFiles(
                new File(srcDirPath)
                , new String[]{"java","log","md","txt","sql","properties","xml"}
                , true);

        for (File javaGbkFile : javaGbkFileCol) {
            //UTF8格式文件路径
            String utf8FilePath = utf8DirPath+javaGbkFile
                    .getAbsolutePath()
                    .substring(srcDirPath.length());
            //使用GBK读取数据,然后用UTF-8写入数据
            FileUtils.writeLines(new File(utf8FilePath)
                    , "UTF-8"
                    , FileUtils.readLines(javaGbkFile, "GBK"));
        }

    }
}

GBK2UTF8.zip

@AkBao
Copy link

AkBao commented May 31, 2017

gb2312

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants
@chengcheng222e @AkBao @iqiancheng @carl-zeiss and others