<p dir="auto">hi, I just use babylon &amp;&amp; babel-traverse &amp;&amp; babel-generator doing something. but after generating, the result has unicode.</p>
<p dir="auto">Choose one: is this a bug report or feature request?<br>
Bug report</p>
<h2 dir="auto">Input Code</h2>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="const fs = require('fs');
const babylon = require('babylon');
const generator = require('babel-generator').default;

const str = `
	import React, { Component } from 'react';
	class ListBase extends Component {
		render() {
  		return &lt;p title=&quot;中国&quot;&gt;杭州&lt;/p&gt;
		}
	}
`
function parse(str) {
	return babylon.parse(str, {
  	    plugins: ['jsx', 'classProperties'],
  	    sourceType: 'module',
	});
}

const ast = parse(str);
const result = generator(ast);
fs.writeFileSync('./new.js', result.code);"><pre class="notranslate"><code class="notranslate">const fs = require('fs');
const babylon = require('babylon');
const generator = require('babel-generator').default;

const str = `
	import React, { Component } from 'react';
	class ListBase extends Component {
		render() {
  		return &lt;p title="中国"&gt;杭州&lt;/p&gt;
		}
	}
`
function parse(str) {
	return babylon.parse(str, {
  	    plugins: ['jsx', 'classProperties'],
  	    sourceType: 'module',
	});
}

const ast = parse(str);
const result = generator(ast);
fs.writeFileSync('./new.js', result.code);
</code></pre></div>
<h2 dir="auto">Expected Behavior</h2>
<p dir="auto"><code class="notranslate">new.js</code> should be:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="import React, { Component } from 'react';
class ListBase extends Component {
    render() {
        return &lt;p title=&quot;中国&quot;&gt;杭州&lt;/p&gt;
    }
}"><pre class="notranslate"><code class="notranslate">import React, { Component } from 'react';
class ListBase extends Component {
    render() {
        return &lt;p title="中国"&gt;杭州&lt;/p&gt;
    }
}
</code></pre></div>
<h2 dir="auto">Current Behavior</h2>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="import React, { Component } from 'react';
class ListBase extends Component {
  render() {
    return &lt;p title=&quot;\u4E2D\u56FD&quot;&gt;杭州&lt;/p&gt;;
  }
}"><pre class="notranslate"><code class="notranslate">import React, { Component } from 'react';
class ListBase extends Component {
  render() {
    return &lt;p title="\u4E2D\u56FD"&gt;杭州&lt;/p&gt;;
  }
}
</code></pre></div>
<p dir="auto">the property <code class="notranslate">title</code> shoud be <code class="notranslate">中国</code>, but after generating , the result is <code class="notranslate">\u4E2D\u56FD</code></p>
<h2 dir="auto">Your Environment</h2>
<table role="table">
<thead>
<tr>
<th>software</th>
<th>versions</th>
</tr>
</thead>
<tbody>
<tr>
<td>babylon</td>
<td>6.18.0</td>
</tr>
<tr>
<td>babel-generator</td>
<td>6.26.0</td>
</tr>
</tbody>
</table>
<p dir="auto">After <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="175672408" data-permission-text="Title is private" data-url="https://github.com/babel/babel/issues/4478" data-hovercard-type="pull_request" data-hovercard-url="/babel/babel/pull/4478/hovercard" href="https://github.com/babel/babel/pull/4478">#4478</a> PR I discovered that Cyrillic text inside a jsx tag transpiled to <code class="notranslate">\uXXXX</code>-style escape sequences. This leads to issues in debug and growing output bundle size. But if I have JSXExpression with StringLiteral all works as expected and text stay unescaped.</p>
<h3 dir="auto">Input Code</h3>

<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="&lt;div&gt;
  &lt;Foo&gt;Привет&lt;/Foo&gt;
  &lt;Foo&gt;{&quot;Привет&quot;}&lt;/Foo&gt;
&lt;/div&gt;"><pre class="notranslate"><span class="pl-c1">&lt;</span><span class="pl-ent">div</span><span class="pl-c1">&gt;</span>
  <span class="pl-c1">&lt;</span><span class="pl-ent">Foo</span><span class="pl-c1">&gt;</span>Привет<span class="pl-c1">&lt;</span><span class="pl-c1">/</span><span class="pl-ent">Foo</span><span class="pl-c1">&gt;</span>
  <span class="pl-c1">&lt;</span><span class="pl-ent">Foo</span><span class="pl-c1">&gt;</span><span class="pl-kos">{</span><span class="pl-s">"Привет"</span><span class="pl-kos">}</span><span class="pl-c1">&lt;</span><span class="pl-c1">/</span><span class="pl-ent">Foo</span><span class="pl-c1">&gt;</span>
<span class="pl-c1">&lt;</span><span class="pl-c1">/</span><span class="pl-ent">div</span><span class="pl-c1">&gt;</span></pre></div>
<h3 dir="auto">Babel Configuration (.babelrc, package.json, cli command)</h3>

<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="{
  &quot;presets&quot;: [
    &quot;react&quot;,
    [&quot;es2015&quot;, { &quot;loose&quot;: true, &quot;modules&quot;: &quot;commonjs&quot;, &quot;spec&quot;: true }],
    &quot;es2016&quot;,
    &quot;es2017&quot;
  ]
}"><pre class="notranslate"><span class="pl-kos">{</span>
  <span class="pl-s">"presets"</span>: <span class="pl-kos">[</span>
    <span class="pl-s">"react"</span><span class="pl-kos">,</span>
    <span class="pl-kos">[</span><span class="pl-s">"es2015"</span><span class="pl-kos">,</span> <span class="pl-kos">{</span> <span class="pl-s">"loose"</span>: <span class="pl-c1">true</span><span class="pl-kos">,</span> <span class="pl-s">"modules"</span>: <span class="pl-s">"commonjs"</span><span class="pl-kos">,</span> <span class="pl-s">"spec"</span>: <span class="pl-c1">true</span> <span class="pl-kos">}</span><span class="pl-kos">]</span><span class="pl-kos">,</span>
    <span class="pl-s">"es2016"</span><span class="pl-kos">,</span>
    <span class="pl-s">"es2017"</span>
  <span class="pl-kos">]</span>
<span class="pl-kos">}</span></pre></div>
<h3 dir="auto">Expected Behavior</h3>


<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="React.createElement(
  &quot;div&quot;,
  null,
  React.createElement(
    Foo,
    null,
    &quot;Привет&quot;
  ),
  React.createElement(
    Foo,
    null,
    &quot;Привет&quot;
  )
);"><pre class="notranslate"><span class="pl-v">React</span><span class="pl-kos">.</span><span class="pl-en">createElement</span><span class="pl-kos">(</span>
  <span class="pl-s">"div"</span><span class="pl-kos">,</span>
  <span class="pl-c1">null</span><span class="pl-kos">,</span>
  <span class="pl-v">React</span><span class="pl-kos">.</span><span class="pl-en">createElement</span><span class="pl-kos">(</span>
    <span class="pl-v">Foo</span><span class="pl-kos">,</span>
    <span class="pl-c1">null</span><span class="pl-kos">,</span>
    <span class="pl-s">"Привет"</span>
  <span class="pl-kos">)</span><span class="pl-kos">,</span>
  <span class="pl-v">React</span><span class="pl-kos">.</span><span class="pl-en">createElement</span><span class="pl-kos">(</span>
    <span class="pl-v">Foo</span><span class="pl-kos">,</span>
    <span class="pl-c1">null</span><span class="pl-kos">,</span>
    <span class="pl-s">"Привет"</span>
  <span class="pl-kos">)</span>
<span class="pl-kos">)</span><span class="pl-kos">;</span></pre></div>
<h3 dir="auto">Current Behavior</h3>


<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="React.createElement(
  &quot;div&quot;,
  null,
  React.createElement(
    Foo,
    null,
    &quot;\u041F\u0440\u0438\u0432\u0435\u0442&quot;
  ),
  React.createElement(
    Foo,
    null,
    &quot;Привет&quot;
  )
);"><pre class="notranslate"><span class="pl-v">React</span><span class="pl-kos">.</span><span class="pl-en">createElement</span><span class="pl-kos">(</span>
  <span class="pl-s">"div"</span><span class="pl-kos">,</span>
  <span class="pl-c1">null</span><span class="pl-kos">,</span>
  <span class="pl-v">React</span><span class="pl-kos">.</span><span class="pl-en">createElement</span><span class="pl-kos">(</span>
    <span class="pl-v">Foo</span><span class="pl-kos">,</span>
    <span class="pl-c1">null</span><span class="pl-kos">,</span>
    <span class="pl-s">"\u041F\u0440\u0438\u0432\u0435\u0442"</span>
  <span class="pl-kos">)</span><span class="pl-kos">,</span>
  <span class="pl-v">React</span><span class="pl-kos">.</span><span class="pl-en">createElement</span><span class="pl-kos">(</span>
    <span class="pl-v">Foo</span><span class="pl-kos">,</span>
    <span class="pl-c1">null</span><span class="pl-kos">,</span>
    <span class="pl-s">"Привет"</span>
  <span class="pl-kos">)</span>
<span class="pl-kos">)</span><span class="pl-kos">;</span></pre></div>
<h3 dir="auto">Possible Solution</h3>


<p dir="auto">Add option to disable generating ASCII-safe code or fix escaping behavior.</p>
<h3 dir="auto">Your Environment</h3>

<table role="table">
<thead>
<tr>
<th>software</th>
<th>version</th>
</tr>
</thead>
<tbody>
<tr>
<td>Babel</td>
<td>6.17.0</td>
</tr>
<tr>
<td>node</td>
<td>6.9.1</td>
</tr>
<tr>
<td>npm</td>
<td>3.10.8</td>
</tr>
<tr>
<td>Operating System</td>
<td>OS X 10.12.1</td>
</tr>
</tbody>
</table>