Android and dealing with illegal characters in file names
<p>My app can accept various files e.g. images and such but the problem is if the file such as an image contains illegal characters clicking on it will crash the app. How can such behavior be avoided? if possible I'd still like to be able to have the image open. Thanks.</p>

<pre><code>    attachedImage.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {               
            Intent intent = new Intent(Intent.ACTION_VIEW);
            String new_string = imageURI.replaceAll(" ", "%20");
            image_uri = Uri.parse("file://" + new_string);
            intent.setDataAndType(image_uri, "image/*");                
            startActivity(intent);
        }
    });
</code></pre>
