Skip to content
This repository has been archived by the owner on Jul 22, 2022. It is now read-only.

Commit

Permalink
Merge pull request #141 from ripvannwinkler/emoji-fix
Browse files Browse the repository at this point in the history
use allowSurrogateChars for emoji support
  • Loading branch information
natergj authored Feb 3, 2018
2 parents d7e3bd4 + c3b4d8a commit 2c8320a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
9 changes: 6 additions & 3 deletions source/lib/workbook/builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ let addRootContentTypesXML = (promiseObj) => {
{
'version': '1.0',
'encoding': 'UTF-8',
'standalone': true
'standalone': true,
'allowSurrogateChars': true
}
)
.att('xmlns', 'http://schemas.openxmlformats.org/package/2006/content-types');
Expand Down Expand Up @@ -264,7 +265,8 @@ let addSharedStringsXML = (promiseObj) => {
{
'version': '1.0',
'encoding': 'UTF-8',
'standalone': true
'standalone': true,
'allowSurrogateChars': true
}
)
.att('count', promiseObj.wb.sharedStrings.length)
Expand Down Expand Up @@ -355,7 +357,8 @@ let addStylesXML = (promiseObj) => {
{
'version': '1.0',
'encoding': 'UTF-8',
'standalone': true
'standalone': true,
'allowSurrogateChars': true
}
)
.att('mc:Ignorable', 'x14ac')
Expand Down
8 changes: 6 additions & 2 deletions source/lib/worksheet/builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -456,9 +456,12 @@ let sheetXML = (ws) => {

let xmlProlog = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>';
let xmlString = '';
let wsXML = xml.begin((chunk) => {
let wsXML = xml.begin({
allowSurrogateChars: true,
}, (chunk) => {
xmlString += chunk;
})

.ele('worksheet')
.att('mc:Ignorable', 'x14ac')
.att('xmlns', 'http://schemas.openxmlformats.org/spreadsheetml/2006/main')
Expand Down Expand Up @@ -517,7 +520,8 @@ let relsXML = (ws) => {
{
'version': '1.0',
'encoding': 'UTF-8',
'standalone': true
'standalone': true,
'allowSurrogateChars': true
}
);
relXML.att('xmlns', 'http://schemas.openxmlformats.org/package/2006/relationships');
Expand Down

0 comments on commit 2c8320a

Please sign in to comment.