Android Square Picasso无法加载土耳其语字符图片网址

Android Square Picasso无法加载土耳其语字符图片网址,第1张

概述我尝试使用方形毕加索Web应用程序.但是,如果我的img网址包含土耳其字符.毕加索无法加载img.这个网址有效.http://www.bulenttiras.com/wp-content/uploads/2014/02/kokhucre.jpg但此网址不起作用http://www.bulenttiras.com/wp-content/uploads/2014/03%C3%BCp-bebek-tedav

我尝试使用方形毕加索Web应用程序.
但是,如果我的img网址包含土耳其语字符.
毕加索无法加载img.

这个网址有效.
http://www.bulenttiras.com/wp-content/uploads/2014/02/kokhucre.jpg

此网址不起作用
http://www.bulenttiras.com/wp-content/uploads/2014/03/t%C3%BCp-bebek-tedavisi.jpg

public class categoryAdapterClass extends BaseAdapter {        private List<categoryHelper> categoryHelpers;        private Context context;        public categoryAdapterClass(List<categoryHelper> categoryHelpers, Context context) {            this.categoryHelpers = categoryHelpers;            this.context = context;        }        @OverrIDe        public int getCount() {            return categoryHelpers.size();        }        @OverrIDe        public categoryHelper getItem(int position) {            return categoryHelpers.get( position );        }        @OverrIDe        public long getItemID(int position) {            return position;        }        @OverrIDe        public VIEw getVIEw(int position, VIEw convertVIEw, VIEwGroup parent) {            VIEwHolder vIEwHolder;            categoryHelper categoryHelper   = getItem( position );            if( convertVIEw == null ) {                vIEwHolder                  = new VIEwHolder();                convertVIEw                 = LayoutInflater.from( context ).inflate(R.layout.all_categorIEs_inflate, parent, false);                vIEwHolder.categoryImage    = (ImageVIEw) convertVIEw.findVIEwByID( R.ID.categoryImage );                vIEwHolder.category_Title   = (TextVIEw) convertVIEw.findVIEwByID( R.ID.category_Title );                vIEwHolder.category_excerpt = (TextVIEw) convertVIEw.findVIEwByID( R.ID.category_excerpt );                convertVIEw.setTag( vIEwHolder );            }            else {                vIEwHolder          = (VIEwHolder) convertVIEw.getTag();            }            String query = null;            try {                query = URLEncoder.encode(categoryHelper.getcategory_image(), "utf-8");            } catch (UnsupportedEnCodingException e) {                e.printstacktrace();            }            vIEwHolder.category_Title.setText( categoryHelper.getcategory_image() );            vIEwHolder.category_excerpt.setText( categoryHelper.getcategory_excerpt() );            Picasso.with( context ).load( query ).into( vIEwHolder.categoryImage );            return convertVIEw;        }        private class VIEwHolder {            ImageVIEw categoryImage;            TextVIEw category_Title;            TextVIEw category_excerpt;        }    }

请帮忙.
对不起英语不好.
谢谢.

解决方法:

我遇到过同样的问题.我唯一能找到的选择就是用编码后的字符替换所有单个土耳其语字符.

public static String encodeTurkishCharactersInUrl(String url) {        String[] List = new String[] {"ü","ç","ı","ö","ğ","ş"," ","Ü","Ç","İ","Ö","Ğ","Ş"};        for (int i = 0; i< List.length ; i++) {            try {                url = url.replace(List[i], URLEncoder.encode(List[i],"UTF-8"));            } catch (UnsupportedEnCodingException e) {                e.printstacktrace();            }        }        return url;    }
总结

以上是内存溢出为你收集整理的Android Square Picasso无法加载土耳其语字符图片网址全部内容,希望文章能够帮你解决Android Square Picasso无法加载土耳其语字符图片网址所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://www.outofmemory.cn/web/1076980.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-26
下一篇 2022-05-26

发表评论

登录后才能评论

评论列表(0条)

保存