Webview - spaces in IMG SRC
<p>I have a ton of HTML files that have roughly 1000 images combined.  Most have spaces in their names.</p>

<p>I am loading these HTML files with </p>

<pre><code>webView.loadDataWithBaseURL(url, data, "text/html", "UTF-8", null);
</code></pre>

<p>Also, the "Src" attribute is prepended with</p>

<pre><code>file:///android_asset/images/
</code></pre>

<p>Image files without spaces in their name work ie:  </p>

<pre><code>src="file:///android_asset/images/my_test_image.jpg"
</code></pre>

<p>However, images with spaces do not load the image ie:</p>

<pre><code>src="file:///android_asset/images/my test image.jpg"
</code></pre>

<p>Is there any way to get the web view to load these images?  Or, do some type of regex to replace spaces inside all "SRC" items with %20 (if that would even work)?</p>

<p>My background in java is pretty limited, I am a C#/Obj-C programmer.  So please help!!</p>

<p>Thanks!</p>

<p>ps:  Most common answer will probably be "rename the images without spaces, and fix all the src tags", but obviously, 200 or so HTML files, and 1000's of images might take awhile.</p>

<p>edit:</p>

<p>I wrote this, but still doesnt work.  I guess java/android doesnt handle %20?</p>

<pre><code>Pattern p=null;
Matcher m= null;
String word0= null;

p= Pattern.compile(".*&lt;img[^&gt;]*src=\"([^\"]*)",Pattern.CASE_INSENSITIVE);
m= p.matcher(data);
while (m.find()){
    word0=m.group(1);
    String originalString = word0.toString();
    data = data.replaceAll(originalString, originalString.replaceAll(" ", "%20"));
}
</code></pre>
