diff --git a/packages/core/src/__snapshots__/convert.test.js.snap b/packages/core/src/__snapshots__/convert.test.js.snap
index 9ceb844e..62a7eea6 100644
--- a/packages/core/src/__snapshots__/convert.test.js.snap
+++ b/packages/core/src/__snapshots__/convert.test.js.snap
@@ -379,6 +379,24 @@ export default SvgComponent
"
`;
+exports[`convert should remove null characters 1`] = `
+"import React from 'react'
+
+const SvgComponent = props => (
+
+)
+
+export default SvgComponent
+"
+`;
+
exports[`convert should remove style tags 1`] = `
"import React from 'react'
diff --git a/packages/core/src/convert.js b/packages/core/src/convert.js
index b597e583..548e8ddd 100644
--- a/packages/core/src/convert.js
+++ b/packages/core/src/convert.js
@@ -9,6 +9,8 @@ async function convert(code, config = {}, state = {}) {
config = { ...DEFAULT_CONFIG, ...config }
state = expandState(state)
let result = code
+ // Remove null-byte character (copy/paste from Illustrator)
+ result = String(result).replace('\0', '')
result = await svgo(result, config, state)
result = await h2x(result, config, state)
result = await transform(result, config, state)
diff --git a/packages/core/src/convert.test.js b/packages/core/src/convert.test.js
index 7fc64dea..a1035cee 100644
--- a/packages/core/src/convert.test.js
+++ b/packages/core/src/convert.test.js
@@ -187,6 +187,27 @@ describe('convert', () => {
expect(result).toMatchSnapshot()
})
+ it('should remove null characters', async () => {
+ const result = await convert(
+ `
+
+\0`
+ )
+
+ expect(result).toMatchSnapshot()
+ expect(result).not.toContain('\0')
+ })
+
describe('config', () => {
const configs = [
[{ dimensions: false }],
@@ -228,3 +249,4 @@ describe('convert', () => {
})
})
})
+