Android URL中文处理
不多说,贴上代码。大家都明确
import java.io.File;
import android.net.Uri;
public class Transition {
/**
* @param uri
* @return
* 中文处理
*/
public static String transition(String imageUrl) {
File f = new File(imageUrl);
if(f.exists()){
//正常逻辑代码
}else{
//处理中文路径
/*try {
imageUrl = URLEncoder.encode(imageUrl,"UTF-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}*/
imageUrl = Uri.encode(imageUrl);
}
imageUrl = imageUrl.replace("%3A", ":");
imageUrl = imageUrl.replace("%2F", "/");
return imageUrl;
}
}
Uri.decode和Uri.encode分析,URLEncoder.encode和URLDecoder.decode分析,URI和URL和URN的差别 请看连接:http://blog.csdn.net/pcaxb/article/details/46859599
Android URL中文处理的更多相关文章
- URL中文转码问题
*:first-child { margin-top: 0 !important; } body > *:last-child { margin-bottom: 0 !important; } ...
- 一种另类的解决URL中文乱码问题--对中文进行加密、解密处理
情景:在资源调度中,首先用户需要选择工作目标,然后跟据选择的工作目标不同而选择不同的账号和代理ip.处理过程如下:点击选择账号,在js中获取工作目标对工作目标进行两次编码(encodeURI(enco ...
- java url中文参数乱码问题
http://www.blogjava.net/jerry-zhaoj/archive/2009/07/16/286993.html 转 JAVA 中URL链接中文参数乱码的处理方法JAVA 中URL ...
- Android Studio中文组(中文社区)
Android Studio中文组(中文社区)http://www.android-studio.org/
- Android API 中文(77)——AdapterView.OnItemSelectedListener
前言 本章内容是android.widget.AdapterView.OnItemSelectedListener,版本为Android 2.3 r1,翻译来自"cnmahj",欢 ...
- Android API 中文(76)——AdapterView.OnItemLongClickListener
前言 本章内容是android.widget.AdapterView.OnItemLongClickListener,版本为Android 2.3 r1,翻译来自"cnmahj", ...
- android api 中文 (75)—— AdapterView.OnItemClickListener
前言 本章内容是android.widget.AdapterView.OnItemClickListener,版本为Android 2.3 r1,翻译来自"麦子",欢迎大家与他交流 ...
- android api 中文 (74)—— AdapterView.AdapterContextMenuInfo
前言 本章内容是android.widget.AdapterView.AdapterContextMenuInfo,版本为Android 2.3 r1,翻译来自"cnmahj",欢 ...
- 解决URL中文乱码问题--对中文进行加密、解密处理
解决URL中文乱码问题--对中文进行加密.解密处理 情景:在资源调度中,首先用户需要选择工作目标,然后跟据选择的工作目标不同而选择不同的账号和代理ip.处理过程如下:点击选择账号,在js中获取工作目标 ...
随机推荐
- django(django项目创建,数据库迁移)
Django项目的创建与介绍 安装:pip3 install django==1.11 查看版本号:django-admin --version 新建项目: 1.切到目标目录 2.django-adm ...
- linux下C++的多线程编程
1. 引言 线程(thread)技术早在60年代就被提出,但真正应用多线程到操作系统中去,是在80年代中期,solaris是这方面的佼佼者.传统的Unix也支持线程的概念,但是在一个进程(proces ...
- 【Oracle】使用dblink+minus方式迁移数据
一.需求说明 1.数据库a104的表syssde.a4_syssde_department中有1000条数据: 2.数据库a230的表syssde.a4_syssde_department中有800条 ...
- 设置vim配置文件使得tab为4个空格
1 set ts=4 2 set expandtab 3 set autoindent
- 【总集】C++ STL类库 vector 使用方法
介绍: 1.vector 的中文名为向量,可以理解为一个序列容器,里面存放的是相同的数据结构类型,类似于数组但与数组又有微妙的不同. 2.vector 采用的是连续动态的空间来存储数据,它是动态的数组 ...
- 【drp 12】再识转发和重定向:SpringMVC无法跳转页面
最近再使用SpringMVC进行页面跳转的时候,不知道发生了什么,始终都无法正确跳转.后来问题解决了,发现是对于转发和重定向没有能很好的理解,以此写篇博客,权当做积累了! 声明:本博客的所有代码,均为 ...
- iOS-APP图标和启动页的尺寸
图标
- BZOJ 2720 [Violet 5]列队春游 ——期望DP
很喵的一道题(我可不是因为看了YOUSIKI的题解才变成这样的) $ans=\sum_{x<=n}\sum_{i<=n} iP(L=i)$ 其中P(x)表示视线为x的概率. 所以只需要求出 ...
- cf468B Two Sets
Little X has n distinct integers: p1, p2, ..., pn. He wants to divide all of them into two sets A an ...
- PHP中的验证码类(准备篇)
<!--code.php内容--> <?php //开启session session_start(); include "vcode.class.php"; / ...