<p><code>GNU sed version 4.1.5</code> seems to fail with International chars. Here is my input file:</p>

<pre><code>Gras Och Stenar Trad - From Moja to Minneapolis DVD [G2007DVD] 7812 | X
&lt;br&gt;
Gras Och Stenar Trad - From Möja to Minneapolis DVD [G2007DVD] 7812 | Y
</code></pre>

<p>(Note the umlaut in the second line.)</p>

<p>And when I do</p>

<pre><code>sed 's/.*| //' &lt; in
</code></pre>

<p>I would expect to see only the <code>X</code> and <code>Y</code>, as I've asked to remove ALL chars up to the <code>'|'</code> and space beyond it. Instead, I get:</p>

<pre><code>X&lt;br&gt;
Gras Och Stenar Trad - From M? Y
</code></pre>

<p>I know I can use tr to remove the International chars. first, but is there a way to just use sed?</p>

[{'answer_id': 67470, 'author': 'Community', 'author_id': -1, 'author_profile': 'https://Stackoverflow.com/users/-1', 'pm_score': 4, 'selected': False, 'text': "<p><code>sed</code> is not very well setup for non-ASCII text. However you can use (almost) the same code in <code>perl</code> and get the result you want:</p>\n\n<pre><code>perl -pe 's/.*\\| //' x\n</code></pre>\n"}, {'answer_id': 67575, 'author': 'Torsten Marek', 'author_id': 9567, 'author_profile': 'https://Stackoverflow.com/users/9567', 'pm_score': 6, 'selected': True, 'text': "<p>I think the error occurs if the input encoding of the file is different from the preferred encoding of your environment. </p>\n\n<p>Example: <code>in</code> is UTF-8</p>\n\n<pre><code>$ LANG=de_DE.UTF-8 sed 's/.*| //' &lt; in\nX\nY\n$ LANG=de_DE.iso88591 sed 's/.*| //' &lt; in\nX \nY\n</code></pre>\n\n<p>UTF-8 can safely be interpreted as ISO-8859-1, you'll get strange characters but apart from that everything is fine.</p>\n\n<p>Example: <code>in</code> is ISO-8859-1</p>\n\n<pre><code>$ LANG=de_DE.UTF-8 sed 's/.*| //' &lt; in\nX\nGras Och Stenar Trad - From MöY\n$ LANG=de_DE.iso88591 sed 's/.*| //' &lt; in\nX \nY\n</code></pre>\n\n<p>ISO-8859-1 cannot be interpreted as UTF-8, decoding the input file fails. The strange match is probably due to the fact that sed tries to recover rather than fail completely.</p>\n\n<p>The answer is based on Debian Lenny/Sid and sed 4.1.5.</p>\n"}]
['https://Stackoverflow.com/questions/67410', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/10251/']