下载韩文文件名 - 解析错误

时间:2014-05-09 08:45:34

标签: java android

以下是我的带有文件名的歌曲的网址。

/iStudioBm/sample/가로수%20그늘%20아래서면.wav

这是请求的方式,并抛出404。

iStudioBm/sample/%EA%B0%80%EB%A1%9C%EC%88%98%20%EA%B7%B8%EB%8A%98%20%EC%95%84%EB%9E%98%EC%84%9C%EB%A9%B4.wav

DownloadManager.Request request = new DownloadManager.Request( Uri.parse(mFileAbsolutePath));//

以上是我必须通过Uri的地方。

        request.setDescription(mFileName+" download");
        request.setTitle("Istudio...");
        request.setAllowedNetworkTypes(DownloadManager.Request.NETWORK_WIFI |
                DownloadManager.Request.NETWORK_MOBILE);

        // in order for this if to run, you must use the android 3.2 to compile your app
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
            request.allowScanningByMediaScanner();
            request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
        }
        request.setDestinationInExternalPublicDir(Environment.getExternalStorageDirectory() + Constants.BASE_FILE_PATH , mFileName);


        // get download service and enqueue file
        DownloadManager manager = (DownloadManager) getSystemService(Context.DOWNLOAD_SERVICE);
        manager.enqueue(request);

我该如何解决这个问题。我只能使用Uri没有接受URL。

1 个答案:

答案 0 :(得分:0)

这样做

try {
            URI uri = new URI("http://yourdomain.com/iStudioBm/sample/가로수%20그늘%20아래서면.wav");
            Uri finalUri = Uri.parse(uri.toASCIIString());

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