Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4403)

Unified Diff: chrome/common/extensions/docs/server2/local_file_system.py

Issue 10804036: Extensions Docs Server: Internationalized samples (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: encodings Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/common/extensions/docs/server2/local_file_system.py
diff --git a/chrome/common/extensions/docs/server2/local_file_system.py b/chrome/common/extensions/docs/server2/local_file_system.py
index fae501cd0ea4972d9f6cdd35c7c8383fa991def7..979e6a14fd5607780869518da36bdcaf435a14c4 100644
--- a/chrome/common/extensions/docs/server2/local_file_system.py
+++ b/chrome/common/extensions/docs/server2/local_file_system.py
@@ -19,7 +19,13 @@ class LocalFileSystem(FileSystem):
def _ReadFile(self, filename):
with open(os.path.join(self._base_path, filename), 'r') as f:
- return f.read()
+ data = f.read()
+ if os.path.splitext(filename)[-1] in ['.js', '.html', '.json']:
+ try:
+ return unicode(data, 'utf-8')
+ except:
+ return unicode(data, 'latin-1')
+ return data
def _ListDir(self, dir_name):
all_files = []

Powered by Google App Engine
This is Rietveld 408576698