Bug 22032

Summary: sed: в локали UTF8 точка в регулярном выражении не матчит не-UTF8 символы
Product: Sisyphus Reporter: Vladislav Zavjalov <slazav>
Component: sedAssignee: placeholder <placeholder>
Status: CLOSED NOTABUG QA Contact: qa-sisyphus
Severity: normal    
Priority: P3 CC: glebfm, ldv, php-coder, placeholder
Version: unstable   
Hardware: all   
OS: Linux   

Description Vladislav Zavjalov 2009-10-22 19:51:03 MSD
#!/bin/bash

printf "\xF7\xCf\xD4" | LC_ALL=ru_RU.UTF8 sed -e 's/./X/g'

# ожидаемый вывод "ХХХ", а выводит исходную строчку без изменений
# при том, что в в info sed написано "Matches any character"
Comment 1 Vladislav Zavjalov 2010-12-13 03:09:42 MSK
В том же info sed наткнулся:

`z'
     This command empties the content of pattern space.  It is usually
     the same as `s/.*//', but is more efficient and works in the
     presence of invalid multibyte sequences in the input stream.
     POSIX mandates that such sequences are _not_ matched by `.', so
     that there is no portable way to clear `sed''s buffers in the
     middle of the script in most multibyte locales (including UTF-8
     locales).

Так что это известно и считается правильным. Закрываю как NOTABUG, сочувствую обитателям локали utf8 :)