You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@zeppelin.apache.org by mo...@apache.org on 2016/07/11 16:24:32 UTC

zeppelin git commit: Fonted download chinese garbled fix

Repository: zeppelin
Updated Branches:
  refs/heads/master 512f05260 -> 513b8ab02


Fonted download chinese garbled  fix

### What is this PR for?
Fix chinese garbled open with Excel #714

### What type of PR is it?
Bug Fix

### Todos
* [x] - Add Bom Header

### What is the Jira issue?
[ZEPPELIN-672](https://issues.apache.org/jira/browse/ZEPPELIN-672)

### How should this be tested?
create a paragraph with chinses chars data in %table view.
download with CSV format and open with Excel.

### Questions:
* Does the licenses files need update?
 No
* Is there breaking changes for older versions?
No
* Does this needs documentation?
No

Author: ZhangEthan <22...@qq.com>

Closes #1151 from cquptEthan/fonted-download-error-code-fix and squashes the following commits:

a4a99b4 [ZhangEthan] Fix  chinese garbled in Excel
46628c2 [ZhangEthan] Merge branch 'apache/master' into fonted-download-error-code-fix


Project: http://git-wip-us.apache.org/repos/asf/zeppelin/repo
Commit: http://git-wip-us.apache.org/repos/asf/zeppelin/commit/513b8ab0
Tree: http://git-wip-us.apache.org/repos/asf/zeppelin/tree/513b8ab0
Diff: http://git-wip-us.apache.org/repos/asf/zeppelin/diff/513b8ab0

Branch: refs/heads/master
Commit: 513b8ab025ee8c6325c7e2c1948d49cb14d95391
Parents: 512f052
Author: ZhangEthan <22...@qq.com>
Authored: Fri Jul 8 08:47:25 2016 +0800
Committer: Lee moon soo <mo...@apache.org>
Committed: Mon Jul 11 09:26:53 2016 -0700

----------------------------------------------------------------------
 zeppelin-web/src/components/saveAs/saveAs.service.js | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/zeppelin/blob/513b8ab0/zeppelin-web/src/components/saveAs/saveAs.service.js
----------------------------------------------------------------------
diff --git a/zeppelin-web/src/components/saveAs/saveAs.service.js b/zeppelin-web/src/components/saveAs/saveAs.service.js
index 7026594..99a685c 100644
--- a/zeppelin-web/src/components/saveAs/saveAs.service.js
+++ b/zeppelin-web/src/components/saveAs/saveAs.service.js
@@ -16,9 +16,11 @@
 angular.module('zeppelinWebApp').service('SaveAsService', function(browserDetectService) {
 
   this.SaveAs = function(content, filename, extension) {
+    var BOM = '\uFEFF';
     if (browserDetectService.detectIE()) {
       angular.element('body').append('<iframe id="SaveAsId" style="display: none"></iframe>');
       var frameSaveAs = angular.element('body > iframe#SaveAsId')[0].contentWindow;
+      content= BOM + content;
       frameSaveAs.document.open('text/json', 'replace');
       frameSaveAs.document.write(content);
       frameSaveAs.document.close();
@@ -34,7 +36,7 @@ angular.module('zeppelinWebApp').service('SaveAsService', function(browserDetect
       }
       angular.element('body > iframe#SaveAsId').remove();
     } else {
-      content = 'data:image/svg;charset=utf-8,' + encodeURIComponent(content);
+      content = 'data:image/svg;charset=utf-8,' + BOM + encodeURIComponent(content);
       angular.element('body').append('<a id="SaveAsId"></a>');
       var saveAsElement = angular.element('body > a#SaveAsId');
       saveAsElement.attr('href', content);
@@ -44,5 +46,4 @@ angular.module('zeppelinWebApp').service('SaveAsService', function(browserDetect
       saveAsElement.remove();
     }
   };
-
 });