views:

1574

answers:

1

Hi, I am using sed from cygwin on Windows to do some substitutions in text files. Everything works fine for normal (ANSI) files, but it doesn't do anything for utf-16 files (no substitutions are made). Do you know how I can make it work for both types of files at the same time?

+3  A: 

I would wrap this with iconv, like

  iconv -f utf-16 -t utf-8 <input | sed -e expr | iconv -f utf-8 -t utf-16 >output
Martin v. Löwis