美文网首页
Android 读取CSV乱码的问题

Android 读取CSV乱码的问题

作者: sssssss_ | 来源:发表于2022-06-22 11:55 被阅读0次
    if (BaseApplication.isZh()) {
        br = new BufferedReader(new InputStreamReader(new FileInputStream(file), U.GB_2312)); // 支持中文描述或点名
    } else {
        br = new BufferedReader(new InputStreamReader(new FileInputStream(file), U.UTF_8));// 其他语言以
    }
    
    // BaseApplication
        public static boolean isZh() {
            return LanguageUtil.isZh(mContext);
        }
    
    
    // LanguageUtil
        public static boolean isZh(Context context) {
            Locale locale = context.getResources().getConfiguration().locale;
            String language = locale.getLanguage();
            String country = locale.getCountry();
            return language.endsWith("zh") && country.equals("CN");
        }
    

    相关文章

      网友评论

          本文标题:Android 读取CSV乱码的问题

          本文链接:https://www.haomeiwen.com/subject/lptuvrtx.html