sort in vim vs. external sort
<p>I found a problem of sorting in vim: the sorting result inside vim is different from the result in terminal.</p>

<p>For example, I have a file <code>test.txt</code></p>

<pre><code>中国
美国
</code></pre>

<p>Both the command <code>:sort</code> and <code>%!sort</code> in vim result in </p>

<pre><code>中国
美国
</code></pre>

<p>which is a wrong alphabetical order. But the command <code>sort test.txt</code> in terminal leads to the correct one</p>

<pre><code>美国
中国
</code></pre>

<p>The locale in both my terminal and vim are <code>en_US.UTF-8</code>, so what is the reason?</p>

<p>Although there is a similar question <a href="https://stackoverflow.com/questions/2683132/how-to-sort-utf-8-lines-in-vim">How to sort UTF-8 lines in Vim?</a>,</p>

<p>However, I want to figure out why <code>:%!sort</code> is different from <code>sort test.txt</code>, while the <code>:!locale</code> is the same with <code>locale</code>. And how to reproduce the vim's behavior in terminal?</p>