1
votes

i am using Picasso for load image from web and local storage

for load image from web

Picasso.with(context).load("http://i.imgur.com/DvpvklR.png").into(imageView);

and for load image from storage i add file:// before path for load image

Picasso.with(context).load("file:///android_asset/DvpvklR.png").into(imageView2);

but when file path have utf-8 charchter with file name its not load the image like file:///android_asset/۲۰۱٧.png

any idea how to solve it every time i want to use picaso its must string path not Uri or File because its saved in sqlite as string

2
I tried putting an image with that file name in my assets folder and Picasso loads it into an ImageView without any problem. I used Picasso 2.5.2, if that matters.Robert Nekic
To clarify, Picasso v2.5.2 works correctly for me when I use the path "file:///android_asset/۲۰۱٧.png" as is, without any encoding (as answers below are suggesting). Perhaps something else is causing a problem?Robert Nekic

2 Answers

1
votes

Try this code:

String url = "file:///android_asset/۲۰۱٧.png";
URLEncoder.encode(url, "UTF-8");
Picasso.with(context).load(url).into(imageView2);
0
votes

try doing

URIUtil.encodeQuery(url)

see the issue at:

https://github.com/square/picasso/issues/652