Repository: zeppelin Updated Branches: refs/heads/branch-0.6 08a3ea21d -> e5b36102a
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 <228477...@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 (cherry picked from commit 513b8ab025ee8c6325c7e2c1948d49cb14d95391) Signed-off-by: Lee moon soo <m...@apache.org> Project: http://git-wip-us.apache.org/repos/asf/zeppelin/repo Commit: http://git-wip-us.apache.org/repos/asf/zeppelin/commit/e5b36102 Tree: http://git-wip-us.apache.org/repos/asf/zeppelin/tree/e5b36102 Diff: http://git-wip-us.apache.org/repos/asf/zeppelin/diff/e5b36102 Branch: refs/heads/branch-0.6 Commit: e5b36102aa79142c2e0472d7fd76cb8b3ce1720d Parents: 08a3ea2 Author: ZhangEthan <228477...@qq.com> Authored: Fri Jul 8 08:47:25 2016 +0800 Committer: Lee moon soo <m...@apache.org> Committed: Mon Jul 11 09:27:12 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/e5b36102/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(); } }; - });