链接和空格中的Jsoup西里尔字母。如何解析?

时间:2015-07-14 07:27:51

标签: java android parsing cyrillic

我尝试从链接中解析一些图像,并且有一些带有cirillic字母的链接。 它看起来像FileNotFoundException。

<img src="http://vao-priut.org/sites/default/files/images/ главной!.thumbnail.jpg">

并且有空间。我该如何解决?

class ParsePage extends AsyncTask<String,Void,String>{
Document doc=null;
Elements names,imgs;

@Override
protected String doInBackground(String... params) {
    try {
        input = new URL("http://vao-priut.org/category/fotokatalog/sektor");
        String link = String.valueOf(input);

            doc = Jsoup.connect(link).get();
            names = doc.select("table.col-3 div.views-field-title span.field-content a[href]");
            imgs = doc.select("table.col-3 div.views-field-image-image span.field-content a img");


            for (Element img : imgs) {

                Element myImage = img;
                String imgSrc = myImage.attr("src");
                InputStream inp = new java.net.URL(imgSrc).openStream();
                // Decode Bitmap
                bitmap = BitmapFactory.decodeStream(inp);

                allImages.add(bitmap);
            }
            for (Element name : names) {
                list.add(name.text());
            }
       /* ProgressDialog mDialog = new ProgressDialog(getActivity());
        mDialog.setMessage("Please wait...");
        mDialog.setCancelable(false);
        mDialog.show();*/


        }catch(IOException e){
            e.printStackTrace();
        }

        return text;
    }

@Override
protected void onPostExecute(String result) {
    super.onPostExecute(result);
    sectorAdapter = new sector_adapter(getActivity());
    c_grid.setAdapter(sectorAdapter);
    image.setImageBitmap(allImages.get(0));
   title.setText(list.get(0));






}

}

这是我的代码。

并且有错误的图像

введите сюда описание изображения image bigger size 1

введите сюда описание изображения image bigger size 2

0 个答案:

没有答案