am 74988900: (-s ours) am be6aab13: Do not add mimetype to url as a query parameter

* commit '7498890092c388dc59ca932e09ec79dd568b1a19':
  Do not add mimetype to url as a query parameter
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index cbca479..315a958 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -17,7 +17,7 @@
 */
 -->
 
-<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
         package="com.android.htmlviewer">
 
     <original-package android:name="com.android.htmlviewer" />
@@ -29,21 +29,21 @@
                 <category android:name="android.intent.category.DEFAULT" />
                 <action android:name="android.intent.action.VIEW" />
                 <data android:scheme="file" />
-                <data android:scheme="content" /> 
+                <data android:scheme="content" />
                 <data android:mimeType="text/html"/>
                 <data android:mimeType="text/plain"/>
                 <data android:mimeType="application/xhtml+xml"/>
                 <data android:mimeType="application/vnd.wap.xhtml+xml"/>
             </intent-filter>
          </activity>
-         
+
          <provider android:name="FileContentProvider"
                  android:exported="false"
                  android:authorities="com.android.htmlfileprovider"
                  android:syncable="false" android:multiprocess="false"
-                 android:grantUriPermissions="true" /> 
+                 android:grantUriPermissions="true" />
 
     </application>
-    
+
 </manifest>
 
diff --git a/res/values-et/strings.xml b/res/values-en-rIN/strings.xml
similarity index 100%
copy from res/values-et/strings.xml
copy to res/values-en-rIN/strings.xml
diff --git a/res/values-et/strings.xml b/res/values-et-rEE/strings.xml
similarity index 100%
rename from res/values-et/strings.xml
rename to res/values-et-rEE/strings.xml
diff --git a/res/values-ms/strings.xml b/res/values-ms-rMY/strings.xml
similarity index 100%
rename from res/values-ms/strings.xml
rename to res/values-ms-rMY/strings.xml
diff --git a/res/values-be/strings.xml b/res/values-zh-rHK/strings.xml
similarity index 90%
rename from res/values-be/strings.xml
rename to res/values-zh-rHK/strings.xml
index 02898f8..d478f99 100644
--- a/res/values-be/strings.xml
+++ b/res/values-zh-rHK/strings.xml
@@ -16,5 +16,5 @@
 
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
-    <string name="app_label" msgid="3773515048729290843">"HTML Viewer"</string>
+    <string name="app_label" msgid="3773515048729290843">"HTML 檢視器"</string>
 </resources>
diff --git a/src/com/android/htmlviewer/FileContentProvider.java b/src/com/android/htmlviewer/FileContentProvider.java
index 2f417a1..6ce0623 100644
--- a/src/com/android/htmlviewer/FileContentProvider.java
+++ b/src/com/android/htmlviewer/FileContentProvider.java
@@ -30,13 +30,13 @@
 
 /**
  * WebView does not support file: loading. This class wraps a file load
- * with a content provider. 
+ * with a content provider.
  * As HTMLViewer does not have internet access nor does it allow
  * Javascript to be run, it is safe to load file based HTML content.
 */
 public class FileContentProvider extends ContentProvider {
-    
-    public static final String BASE_URI = 
+
+    public static final String BASE_URI =
             "content://com.android.htmlfileprovider";
 
     @Override
@@ -45,7 +45,7 @@
         String mimetype = uri.getQuery();
         return mimetype == null ? "" : mimetype;
     }
-    
+
     @Override
     public ParcelFileDescriptor openFile(Uri uri, String mode) throws FileNotFoundException {
         // android:exported="false" is broken in older releases so we have to
@@ -60,7 +60,7 @@
         return ParcelFileDescriptor.open(new File(filename),
             ParcelFileDescriptor.MODE_READ_ONLY);
     }
-    
+
     @Override
     public int delete(Uri uri, String selection, String[] selectionArgs) {
         throw new UnsupportedOperationException();
diff --git a/src/com/android/htmlviewer/HTMLViewerActivity.java b/src/com/android/htmlviewer/HTMLViewerActivity.java
index 2e46e49..f51d68b 100644
--- a/src/com/android/htmlviewer/HTMLViewerActivity.java
+++ b/src/com/android/htmlviewer/HTMLViewerActivity.java
@@ -34,51 +34,54 @@
 import java.io.InputStream;
 
 /**
- * Wraps a WebView widget within an Activity. When launched, it uses the 
- * URI from the intent as the URL to load into the WebView. 
+ * Wraps a WebView widget within an Activity. When launched, it uses the
+ * URI from the intent as the URL to load into the WebView.
  * It supports all URLs schemes that a standard WebView supports, as well as
  * loading the top level markup using the file scheme.
- * The WebView default settings are used with the exception of normal layout 
+ * The WebView default settings are used with the exception of normal layout
  * is set.
  * This activity shows a loading progress bar in the window title and sets
  * the window title to the title of the content.
  *
  */
 public class HTMLViewerActivity extends Activity {
-    
+
+    // TODO: Make public on android.content.Intent.
+    private static final String EXTRA_TEXT_ENCODING = "android.intent.extra.TEXT_ENCODING";
+
     /*
      * The WebView that is placed in this Activity
      */
     private WebView mWebView;
-    
+
     /*
-     * As the file content is loaded completely into RAM first, set 
+     * As the file content is loaded completely into RAM first, set
      * a limitation on the file size so we don't use too much RAM. If someone
      * wants to load content that is larger than this, then a content
      * provider should be used.
      */
     static final int MAXFILESIZE = 8096;
-    
+
     static final String LOGTAG = "HTMLViewerActivity";
 
     @Override
     protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
 
-        // Call createInstance() explicitly. createInstance() is called in 
-        // BrowserFrame by WebView. As it is called in WebCore thread, it can 
+        // Call createInstance() explicitly. createInstance() is called in
+        // BrowserFrame by WebView. As it is called in WebCore thread, it can
         // happen after onResume() is called. To use getInstance() in onResume,
         // createInstance() needs to be called first.
         CookieSyncManager.createInstance(this);
 
         requestWindowFeature(Window.FEATURE_PROGRESS);
-        
+
         mWebView = new WebView(this);
         setContentView(mWebView);
-        
+
         // Setup callback support for title and progress bar
         mWebView.setWebChromeClient( new WebChrome() );
-        
+
         // Configure the webview
         WebSettings s = mWebView.getSettings();
         s.setUseWideViewPort(true);
@@ -87,11 +90,11 @@
         s.setSavePassword(false);
         s.setSaveFormData(false);
         s.setBlockNetworkLoads(true);
-        
-        // Javascript is purposely disabled, so that nothing can be 
+
+        // Javascript is purposely disabled, so that nothing can be
         // automatically run.
         s.setJavaScriptEnabled(false);
-        
+
         // Restore a webview if we are meant to restore
         if (savedInstanceState != null) {
             mWebView.restoreState(savedInstanceState);
@@ -103,23 +106,28 @@
                 String contentUri = "file".equals(uri.getScheme())
                         ? FileContentProvider.BASE_URI + uri.getEncodedPath()
                         : uri.toString();
+                String encoding = intent.getStringExtra(EXTRA_TEXT_ENCODING);
+                if (encoding != null) {
+                    Log.i(LOGTAG, "Intent is forcing text encoding to: " + encoding);
+                    s.setDefaultTextEncodingName(encoding);
+                }
                 mWebView.loadUrl(contentUri);
             }
         }
     }
-    
+
     @Override
     protected void onResume() {
         super.onResume();
-        CookieSyncManager.getInstance().startSync(); 
+        CookieSyncManager.getInstance().startSync();
     }
-    
+
     @Override
     protected void onSaveInstanceState(Bundle outState) {
         // the default implementation requires each view to have an id. As the
         // browser handles the state itself and it doesn't use id for the views,
         // don't call the default implementation. Otherwise it will trigger the
-        // warning like this, "couldn't save which view has focus because the 
+        // warning like this, "couldn't save which view has focus because the
         // focused view XXX has no id".
         mWebView.saveState(outState);
     }
@@ -127,23 +135,23 @@
     @Override
     protected void onStop() {
         super.onStop();
-        
-        CookieSyncManager.getInstance().stopSync(); 
+
+        CookieSyncManager.getInstance().stopSync();
     }
-    
+
     @Override
     protected void onDestroy() {
         super.onDestroy();
         mWebView.destroy();
     }
-    
+
     class WebChrome extends WebChromeClient {
-        
+
         @Override
         public void onReceivedTitle(WebView view, String title) {
             HTMLViewerActivity.this.setTitle(title);
         }
-        
+
         @Override
         public void onProgressChanged(WebView view, int newProgress) {
             getWindow().setFeatureInt(
@@ -153,5 +161,5 @@
             }
         }
     }
-    
+
 }