Quantcast
Channel: Active questions tagged utf-8 - Stack Overflow
Viewing all articles
Browse latest Browse all 1214

How to handle UTF-8 emoji in sed on Cygwin?

$
0
0

I've seen many topics about escaping and replacing a special character in SED, but none of them helped me.

I have this sed command I need to use on a file:

sed -i "s/This[^\|]\+/& (cool) /g" "file.txt"

For a reason I don't understand, it applies to this test case:

This is my funny 🎺 char and this | char is the char after which  i want to stop my job.

... and transforms it to :

This is my funny 🎠(cool) ڠchar and this | char is the char after which  i want to stop my job.

... instead of :

This is my funny 🎺 char and this  (cool) | char is the char after which  i want to stop my job.

Can anybody tell me how to handle this kind of case ?

Note : the file is UTF-8 encoded, I use Cygwin that is UTF-8 encoded and my SED command is in a ".sh" file that is UTF-8 encoded too.


Viewing all articles
Browse latest Browse all 1214

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>